macros.hpp File Reference

Various macros useful for development. More...

#include <ecl/config/ecl.hpp>
Include dependency graph for macros.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


 C++11 support is available. More...
 Deprecated compiler warnings. More...
 Prevents a function from being inlined. More...
 Declare public visibility for libraries. More...
#define ECL_LOCAL
#define ECL_PUBLIC

Detailed Description

Various macros useful for development.

September 2010

Definition in file macros.hpp.

Macro Definition Documentation


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,

1 nm -C -D <library>.so


Each package needs to create it's own macro to make use of the macro that cmake defines for library targets:

1 #ifdef ROS_BUILD_SHARED_LIBS // ros is being built around shared libraries
2  #ifdef ecl_common_EXPORTS // we are building a shared lib/dll
3  #define ecl_common_PUBLIC ROS_HELPER_EXPORT
4  #else // we are using shared lib/dll
5  #define ecl_common_PUBLIC ROS_HELPER_IMPORT
6  #endif
7 #else // ros is being built around static libraries
8  #define ecl_common_DECL
9 #endif

And use it alongside class or function definitions:

1 extern "C" ecl_common_PUBLIC void function(int a);
2 class ecl_common_PUBLIC SomeClass {
3  int c;
4  ecl_common_LOCAL void privateMethod(); // Only for use within this DSO
5 public:
6  Person(int _c) : c(_c) { }
7  static void foo(int a);
8 };
See also

Definition at line 163 of file macros.hpp.

See also

Definition at line 162 of file macros.hpp.

See also

Definition at line 164 of file macros.hpp.

#define ECL_LOCAL

Definition at line 170 of file macros.hpp.

#define ECL_PUBLIC

Definition at line 169 of file macros.hpp.

Author(s): Daniel Stonier
autogenerated on Fri Jun 7 2019 21:52:41