Define ECL_HELPER_EXPORTο
Defined in File macros.hpp
Define Documentationο
-
ECL_HELPER_EXPORTο
Declare public visibility for libraries.
This emits (in a cross platform way) the required symbols for setting whether a function/class should be visible or hidden. Note only does this protect the private parts of your library, but it can also greatly speed up the linking process.
To check what symbols are being exported for a gnu library,
nm -C -D <library>.so
Usage:
Each package needs to create itβs own macro to make use of the macro that cmake defines for library targets:
#ifdef ROS_BUILD_SHARED_LIBS // ros is being built around shared libraries #ifdef ecl_common_EXPORTS // we are building a shared lib/dll #define ecl_common_PUBLIC ROS_HELPER_EXPORT #else // we are using shared lib/dll #define ecl_common_PUBLIC ROS_HELPER_IMPORT #endif #else // ros is being built around static libraries #define ecl_common_DECL #endif
And use it alongside class or function definitions:
extern "C" ecl_common_PUBLIC void function(int a); class ecl_common_PUBLIC SomeClass { int c; ecl_common_LOCAL void privateMethod(); // Only for use within this DSO public: Person(int _c) : c(_c) { } static void foo(int a); };
See also