From 656153da5da682b1223ea3fed05a677ed6bdc69e Mon Sep 17 00:00:00 2001 From: Eduardo Ponz Segrelles Date: Tue, 12 Mar 2024 15:00:51 +0100 Subject: [PATCH] Migrate DLL API exporter to fastdds (#104) * Refs #20569: Rename RTPS_DllAPI to FASTDDS_EXPORTED_API Signed-off-by: EduPonz * Refs #20569: Fix compilation due to movement of LibrarySettings in Fast DDS Signed-off-by: EduPonz --------- Signed-off-by: EduPonz --- fastdds_python/src/swig/fastdds.i | 3 ++- .../src/swig/fastdds/LibrarySettings.i | 19 +++++++++++++++++++ .../fastdds/dds/domain/DomainParticipant.i | 6 +++--- .../swig/fastdds/dds/subscriber/Subscriber.i | 2 +- fastdds_python/test/types/test_complete.i | 2 +- .../test/types/test_included_modules.i | 2 +- fastdds_python/test/types/test_modules.i | 2 +- .../HelloWorldExample/HelloWorld.i | 2 +- 8 files changed, 29 insertions(+), 9 deletions(-) create mode 100644 fastdds_python/src/swig/fastdds/LibrarySettings.i diff --git a/fastdds_python/src/swig/fastdds.i b/fastdds_python/src/swig/fastdds.i index 0f7b062e..e6a00101 100644 --- a/fastdds_python/src/swig/fastdds.i +++ b/fastdds_python/src/swig/fastdds.i @@ -89,7 +89,7 @@ bool has_statistics(); // Macro delcarations // Any macro used on the Fast DDS header files will give an error if it is not redefined here -#define RTPS_DllAPI +#define FASTDDS_EXPORTED_API #define FASTDDS_DEPRECATED_UNTIL(major, entity_name, msg) #define FASTDDS_TODO_BEFORE(major, minor, msg) @@ -123,6 +123,7 @@ namespace builtin { %include "fastcdr/xcdr/optional.i" #endif +%include "fastdds/LibrarySettings.i" %include "fastdds/rtps/common/VendorId_t.i" %include "fastdds/rtps/common/Types.i" %include "fastdds/rtps/common/Time_t.i" diff --git a/fastdds_python/src/swig/fastdds/LibrarySettings.i b/fastdds_python/src/swig/fastdds/LibrarySettings.i new file mode 100644 index 00000000..02b00ee0 --- /dev/null +++ b/fastdds_python/src/swig/fastdds/LibrarySettings.i @@ -0,0 +1,19 @@ +// Copyright 2024 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +%{ +#include "fastdds/LibrarySettings.hpp" +%} + +%include "fastdds/LibrarySettings.hpp" diff --git a/fastdds_python/src/swig/fastdds/dds/domain/DomainParticipant.i b/fastdds_python/src/swig/fastdds/dds/domain/DomainParticipant.i index 4e62f13c..8456696a 100644 --- a/fastdds_python/src/swig/fastdds/dds/domain/DomainParticipant.i +++ b/fastdds_python/src/swig/fastdds/dds/domain/DomainParticipant.i @@ -84,7 +84,7 @@ if (nullptr != listener) { Swig::Director* director = SWIG_DIRECTOR_CAST(listener); - + if (nullptr != director) { Py_INCREF(director->swig_get_self()); @@ -93,7 +93,7 @@ if (nullptr != old_listener) { Swig::Director* director = SWIG_DIRECTOR_CAST(old_listener); - + if (nullptr != director) { Py_DECREF(director->swig_get_self()); @@ -227,7 +227,7 @@ * @param mask StatusMask that holds statuses the listener responds to (default: all) * @return Pointer to the created Subscriber. */ - RTPS_DllAPI Subscriber* create_subscriber_with_profile( + FASTDDS_EXPORTED_API Subscriber* create_subscriber_with_profile( const std::string& profile_name, SubscriberListener* listener = nullptr, const StatusMask& mask = eprosima::fastdds::dds::StatusMask::all()) diff --git a/fastdds_python/src/swig/fastdds/dds/subscriber/Subscriber.i b/fastdds_python/src/swig/fastdds/dds/subscriber/Subscriber.i index 65d82039..3fc70aec 100644 --- a/fastdds_python/src/swig/fastdds/dds/subscriber/Subscriber.i +++ b/fastdds_python/src/swig/fastdds/dds/subscriber/Subscriber.i @@ -145,7 +145,7 @@ * @param mask StatusMask that holds statuses the listener responds to (default: all). * @return Pointer to the created DataReader. nullptr if failed. */ - RTPS_DllAPI DataReader* create_datareader_with_profile( + FASTDDS_EXPORTED_API DataReader* create_datareader_with_profile( TopicDescription* topic, const std::string& profile_name, DataReaderListener* listener = nullptr, diff --git a/fastdds_python/test/types/test_complete.i b/fastdds_python/test/types/test_complete.i index 629d3567..a43eed15 100644 --- a/fastdds_python/test/types/test_complete.i +++ b/fastdds_python/test/types/test_complete.i @@ -35,7 +35,7 @@ // Macro declarations // Any macro used on the Fast DDS header files will give an error if it is not redefined here -#define RTPS_DllAPI +#define FASTDDS_EXPORTED_API #define eProsima_user_DllExport %include "test_included_modules.i" diff --git a/fastdds_python/test/types/test_included_modules.i b/fastdds_python/test/types/test_included_modules.i index ab3c0b66..997f6c6a 100644 --- a/fastdds_python/test/types/test_included_modules.i +++ b/fastdds_python/test/types/test_included_modules.i @@ -35,7 +35,7 @@ // Macro declarations // Any macro used on the Fast DDS header files will give an error if it is not redefined here -#define RTPS_DllAPI +#define FASTDDS_EXPORTED_API #define eProsima_user_DllExport diff --git a/fastdds_python/test/types/test_modules.i b/fastdds_python/test/types/test_modules.i index b26a9895..131bc5b5 100644 --- a/fastdds_python/test/types/test_modules.i +++ b/fastdds_python/test/types/test_modules.i @@ -35,7 +35,7 @@ // Macro declarations // Any macro used on the Fast DDS header files will give an error if it is not redefined here -#define RTPS_DllAPI +#define FASTDDS_EXPORTED_API #define eProsima_user_DllExport diff --git a/fastdds_python_examples/HelloWorldExample/HelloWorld.i b/fastdds_python_examples/HelloWorldExample/HelloWorld.i index 5af81f0a..34c71dd7 100644 --- a/fastdds_python_examples/HelloWorldExample/HelloWorld.i +++ b/fastdds_python_examples/HelloWorldExample/HelloWorld.i @@ -35,7 +35,7 @@ // Macro declarations // Any macro used on the Fast DDS header files will give an error if it is not redefined here -#define RTPS_DllAPI +#define FASTDDS_EXPORTED_API #define eProsima_user_DllExport