DDS_PublisherQos publisher_qos; // MyPublisherListener is user defined and // extends DDSPublisherListener DDSPublisherListener* publisher_listener = = new MyPublisherListener(); // or = NULL participant->get_default_publisher_qos(publisher_qos); DDSPublisher* publisher = participant->create_publisher(publisher_qos, publisher_listener, DDS_STATUS_MASK_ALL); if (publisher == NULL) { // ... error };
DDS_ReturnCode_t retcode; retcode = participant->delete_publisher(publisher); if (retcode != DDS_RETCODE_OK) { // ... check for cause of failure }