api.h
Go to the documentation of this file.
1 /*
2  * Copyright 2015-2019 CNRS-UM LIRMM, CNRS-AIST JRL
3  */
4 
5 #pragma once
6 
7 // Package version (header).
8 #define MC_RTC_ROS_VERSION "UNKNOWN-dirty"
9 
10 // Handle portable symbol export.
11 // Defining manually which symbol should be exported is required
12 // under Windows whether MinGW or MSVC is used.
13 //
14 // The headers then have to be able to work in two different modes:
15 // - dllexport when one is building the library,
16 // - dllimport for clients using the library.
17 //
18 // On Linux, set the visibility accordingly. If C++ symbol visibility
19 // is handled by the compiler, see: http://gcc.gnu.org/wiki/Visibility
20 #if defined _WIN32 || defined __CYGWIN__
21 // On Microsoft Windows, use dllimport and dllexport to tag symbols.
22 # define MC_RTC_ROS_DLLIMPORT __declspec(dllimport)
23 # define MC_RTC_ROS_DLLEXPORT __declspec(dllexport)
24 # define MC_RTC_ROS_DLLLOCAL
25 #else
26 // On Linux, for GCC >= 4, tag symbols using GCC extension.
27 # if __GNUC__ >= 4
28 # define MC_RTC_ROS_DLLIMPORT __attribute__((visibility("default")))
29 # define MC_RTC_ROS_DLLEXPORT __attribute__((visibility("default")))
30 # define MC_RTC_ROS_DLLLOCAL __attribute__((visibility("hidden")))
31 # else
32 // Otherwise (GCC < 4 or another compiler is used), export everything.
33 # define MC_RTC_ROS_DLLIMPORT
34 # define MC_RTC_ROS_DLLEXPORT
35 # define MC_RTC_ROS_DLLLOCAL
36 # endif // __GNUC__ >= 4
37 #endif // defined _WIN32 || defined __CYGWIN__
38 
39 #ifdef MC_RTC_ROS_STATIC
40 // If one is using the library statically, get rid of
41 // extra information.
42 # define MC_RTC_ROS_DLLAPI
43 # define MC_RTC_ROS_LOCAL
44 #else
45 // Depending on whether one is building or using the
46 // library define DLLAPI to import or export.
47 # ifdef MC_RTC_ROS_EXPORTS
48 # define MC_RTC_ROS_DLLAPI MC_RTC_ROS_DLLEXPORT
49 # else
50 # define MC_RTC_ROS_DLLAPI MC_RTC_ROS_DLLIMPORT
51 # endif // MC_RTC_ROS_EXPORTS
52 # define MC_RTC_ROS_LOCAL MC_RTC_ROS_DLLLOCAL
53 #endif // MC_RTC_ROS_STATIC