Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow sharing DomainParticipant with C++ applications #25

Merged
merged 3 commits into from
Apr 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,14 @@
#define RMW_CONNEXT_FAST_ENDPOINT_DISCOVERY 1
#endif /* RMW_CONNEXT_FAST_ENDPOINT_DISCOVERY */

/******************************************************************************
* Modify DomainParticipantQos to allow sharing of DDS entities created with
* the Connext C API with applications using the C++11 API.
******************************************************************************/
#ifndef RMW_CONNEXT_SHARE_DDS_ENTITIES_WITH_CPP
#define RMW_CONNEXT_SHARE_DDS_ENTITIES_WITH_CPP 1
#endif /* RMW_CONNEXT_SHARE_DDS_ENTITIES_WITH_CPP */

/******************************************************************************
* Override dds.transport.UDPv4.builtin.ignore_loopback_interface in
* DomainParticipantQos to force communication over loopback (in addition to
Expand Down
14 changes: 14 additions & 0 deletions rmw_connextdds_common/src/ndds/dds_api_ndds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,20 @@ rmw_connextdds_initialize_participant_qos_impl(
}
#endif /* RMW_CONNEXT_FAST_ENDPOINT_DISCOVERY */

#if RMW_CONNEXT_SHARE_DDS_ENTITIES_WITH_CPP
// UserObjectQosPolicy is an internal, undocumented Connext policy used by the
// implementations of different language bindings to control the memory
// representations of various objects created by user applications. In this
// case, the settings match the requirements of the "modern C++" API, and they
// allow the DomainParticipant to be used directly by applications that want
// to create new entities in C++11, even though the participant was created
// using the C API. If these settings are not specified, an application will
// receive a SIGSEGV when trying to create one of these entities.
dp_qos->user_object.flow_controller_user_object.size = sizeof(void *);
dp_qos->user_object.topic_user_object.size = sizeof(void *);
dp_qos->user_object.content_filtered_topic_user_object.size = sizeof(void *);
#endif /* RMW_CONNEXT_SHARE_DDS_ENTITIES_WITH_CPP */

return RMW_RET_OK;
}

Expand Down