From 36702093610a1075f6da74d605e29f867f38718e Mon Sep 17 00:00:00 2001 From: Troy Straszheim Date: Tue, 19 Jul 2011 15:49:27 +0000 Subject: [PATCH] Fix windows visibility macros. --- core/roslib/include/ros/package.h | 47 ++++++++++++++++++++++++------- 1 file changed, 37 insertions(+), 10 deletions(-) diff --git a/core/roslib/include/ros/package.h b/core/roslib/include/ros/package.h index a5c685b5..3bb288e2 100644 --- a/core/roslib/include/ros/package.h +++ b/core/roslib/include/ros/package.h @@ -32,20 +32,47 @@ #include #include -/***************************************************************************** - * Library Export Macros - ****************************************************************************/ +#if defined(__GNUC__) +# define ROS_DEPRECATED __attribute__((deprecated)) +# define ROS_FORCE_INLINE __attribute__((always_inline)) +#elif defined(MSVC) +# define ROS_DEPRECATED +# define ROS_FORCE_INLINE __forceinline +#else +# define ROS_DEPRECATED +# define ROS_FORCE_INLINE inline +#endif -#include +/* + Windows import/export and gnu http://gcc.gnu.org/wiki/Visibility + macros. + */ + +#if defined(_MSC_VER) +# define ROS_HELPER_IMPORT __declspec(dllimport) +# define ROS_HELPER_EXPORT __declspec(dllexport) +#elif __GNUC__ >= 4 +# define ROS_HELPER_IMPORT __attribute__ ((visibility("default"))) +# define ROS_HELPER_EXPORT __attribute__ ((visibility("default"))) +#else +# define ROS_HELPER_IMPORT +# define ROS_HELPER_EXPORT +#endif + +// Ignore warnings about import/exports when deriving from std classes. +#ifdef _MSC_VER +# pragma warning(disable: 4251) +# pragma warning(disable: 4275) +#endif #ifdef ROS_BUILD_SHARED_LIBS // ros is being built around shared libraries - #ifdef roslib_EXPORTS // we are building a shared lib/dll - #define ROSLIB_DECL ROS_HELPER_EXPORT - #else // we are using shared lib/dll - #define ROSLIB_DECL ROS_HELPER_IMPORT - #endif +# ifdef roslib_EXPORTS // we are building a shared lib/dll +# define ROSLIB_DECL ROS_HELPER_EXPORT +# else // we are using shared lib/dll +# define ROSLIB_DECL ROS_HELPER_IMPORT +# endif #else // ros is being built around static libraries - #define ROSLIB_DECL +# define ROSLIB_DECL #endif namespace ros