You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Looking at visibility_control.hpp (and all of these throughout the ROS2 codebase), it seems like it was never designed for static linkage on Windows. Say I don't have RCLCPP_BUILDING_LIBRARY in my preprocessor flags, RCLCPP_PUBLIC_TYPE will use __declspec(dllimport), which is probably not what you want during statically linking. Other libraries tend to just leave those defines blank --even the second example in the linked website in the header does that (https://gcc.gnu.org/wiki/Visibility).
Am I missing something fundamental here? C++ isn't my strong suite, but I'm trying to get static libraries instead of shared libraries/.dlls.
Thank you!
#ifndef RCLCPP__VISIBILITY_CONTROL_HPP_
#defineRCLCPP__VISIBILITY_CONTROL_HPP_// This logic was borrowed (then namespaced) from the examples on the gcc wiki:// https://gcc.gnu.org/wiki/Visibility
#if defined _WIN32 || defined __CYGWIN__
#ifdef __GNUC__
#defineRCLCPP_EXPORT__attribute__ ((dllexport))
#define RCLCPP_IMPORT __attribute__ ((dllimport))
#else
#defineRCLCPP_EXPORT__declspec(dllexport)
#define RCLCPP_IMPORT __declspec(dllimport)
#endif
#ifdef RCLCPP_BUILDING_LIBRARY
#defineRCLCPP_PUBLIC RCLCPP_EXPORT
#else
#defineRCLCPP_PUBLIC RCLCPP_IMPORT
#endif
#defineRCLCPP_PUBLIC_TYPE RCLCPP_PUBLIC
#defineRCLCPP_LOCAL
#else
#defineRCLCPP_EXPORT__attribute__ ((visibility("default")))
#define RCLCPP_IMPORT
#if __GNUC__ >= 4
#defineRCLCPP_PUBLIC__attribute__ ((visibility("default")))
#define RCLCPP_LOCAL __attribute__ ((visibility("hidden")))
#else
#defineRCLCPP_PUBLIC
#defineRCLCPP_LOCAL
#endif
#defineRCLCPP_PUBLIC_TYPE
#endif
#endif// RCLCPP__VISIBILITY_CONTROL_HPP_
The text was updated successfully, but these errors were encountered:
It might be fine? This person had a similar question and said compiling static libraries on Windows with __declspec(...), and they reported the static library still worked. I wasn't able to find Microsoft docs on this from a quick search though.
Looking at
visibility_control.hpp
(and all of these throughout the ROS2 codebase), it seems like it was never designed for static linkage on Windows. Say I don't haveRCLCPP_BUILDING_LIBRARY
in my preprocessor flags,RCLCPP_PUBLIC_TYPE
will use__declspec(dllimport)
, which is probably not what you want during statically linking. Other libraries tend to just leave those defines blank --even the second example in the linked website in the header does that (https://gcc.gnu.org/wiki/Visibility).Am I missing something fundamental here? C++ isn't my strong suite, but I'm trying to get static libraries instead of shared libraries/.dlls.
Thank you!
The text was updated successfully, but these errors were encountered: