ros2 / rosidl_typesupport

Packages which provide the typesupport for ROS messages and services
Apache License 2.0
13 stars 34 forks source link

rosidl_typesupport_cpp generated library should use a visibility macro that's unique to it #142

Open sloretz opened 1 year ago

sloretz commented 1 year ago

The package rosidl_typesupport_cpp ships with a utility library called rosidl_typesupport_cpp which uses the preprocessor definition ROSIDL_TYPESUPPORT_CPP_BUILDING_DLL to control dllimport/dllexport on Windows.

However, when a package generates a library for ROS messages, the rosidl_typesupport_cpp generator also generates a package specific library which also uses ROSIDL_TYPESUPPORT_CPP_BUILDING_DLL as the preprocessor definition for it's visibility macros.

If the generated library were to include the utility library, then at the build time of the generated library the visibility macros in the headers of the utility library would incorrectly say dllexport, meaning the generated library would be built as if the utility library's symbols also lived inside the generated library and need to be exported.

To fix this, the generated library should have its own visibility header and macro.