humoto
export_import.h
Go to the documentation of this file.
1 /**
2  @file
3  @author Alexander Sherikov
4  @copyright 2014-2017 INRIA. Licensed under the Apache License, Version 2.0.
5  (see @ref LICENSE or http://www.apache.org/licenses/LICENSE-2.0)
6 
7  @brief based on the example taken from https://gcc.gnu.org/wiki/Visibility
8 */
9 
10 
11 #ifdef HUMOTO_DOXYGEN_PROCESSING
12  // enter this branch only during the documentation generation
13 
14  /**
15  * This macro sets visibility parameters of the classes that should be
16  * exported from the compiled library.
17  * This macro is defined automatically.
18  */
19  #define HUMOTO_API
20 
21  /**
22  * This macro sets visibility parameters of the classes that should NOT be
23  * exported from the compiled library.
24  * This macro is defined automatically.
25  */
26  #define HUMOTO_LOCAL
27 
28  /**
29  * This should be defined if humoto is compiled in a shared library to hide
30  * classes defied with HUMOTO_LOCAL.
31  */
32  #define HUMOTO_COMPILE_SHARED_LIB
33 
34  /**
35  * This should be defined if some sources are compiled using a library
36  * containing humoto. This should be neccessary on WIN platforms, which we
37  * do not support currently.
38  */
39  #define HUMOTO_IMPORT_LIB
40 
41 #else
42 
43  // helper macro depending on the compiler
44  #if defined _WIN32 || defined __CYGWIN__
45  #define HUMOTO_LIB_IMPORT __declspec(dllimport)
46  #define HUMOTO_LIB_EXPORT __declspec(dllexport)
47  #define HUMOTO_LIB_LOCAL
48  #else
49  #if __GNUC__ >= 4
50  #define HUMOTO_LIB_IMPORT __attribute__ ((visibility ("default")))
51  #define HUMOTO_LIB_EXPORT __attribute__ ((visibility ("default")))
52  #define HUMOTO_LIB_LOCAL __attribute__ ((visibility ("hidden")))
53  #else
54  #define HUMOTO_LIB_IMPORT
55  #define HUMOTO_LIB_EXPORT
56  #define HUMOTO_LIB_LOCAL
57  #endif
58  #endif
59 
60  #ifdef HUMOTO_COMPILE_SHARED_LIB
61  // compiled as a shared library (the default)
62  #define HUMOTO_LOCAL HUMOTO_LIB_LOCAL
63 
64  #ifdef HUMOTO_IMPORT_LIB
65  // this apparently makes sense only in WIN
66  #define HUMOTO_API HUMOTO_LIB_IMPORT
67  #else
68  #define HUMOTO_API HUMOTO_LIB_EXPORT
69  #endif
70  #else
71  // compiled as a static library
72  #define HUMOTO_API
73  #define HUMOTO_LOCAL
74  #endif
75 
76 #endif // HUMOTO_DOXYGEN_PROCESSING