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