Fast DDS  Version 3.6.1.0
Fast DDS
fastdds_dll.hpp
1 // Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
20 #ifndef FASTDDS_FASTDDS_DLL_H
21 #define FASTDDS_FASTDDS_DLL_H
22 
23 #include <fastdds/config.hpp>
24 
25 // normalize macros
26 #if !defined(FASTDDS_DYN_LINK) && !defined(FASTDDS_STATIC_LINK) \
27  && !defined(EPROSIMA_ALL_DYN_LINK) && !defined(EPROSIMA_ALL_STATIC_LINK)
28 #define FASTDDS_STATIC_LINK
29 #endif \
30  // if !defined(FASTDDS_DYN_LINK) && !defined(FASTDDS_STATIC_LINK) && !defined(EPROSIMA_ALL_DYN_LINK) && !defined(EPROSIMA_ALL_STATIC_LINK)
31 
32 #if defined(EPROSIMA_ALL_DYN_LINK) && !defined(FASTDDS_DYN_LINK)
33 #define FASTDDS_DYN_LINK
34 #endif // if defined(EPROSIMA_ALL_DYN_LINK) && !defined(FASTDDS_DYN_LINK)
35 
36 #if defined(FASTDDS_DYN_LINK) && defined(FASTDDS_STATIC_LINK)
37 #error Must not define both FASTDDS_DYN_LINK and FASTDDS_STATIC_LINK
38 #endif // if defined(FASTDDS_DYN_LINK) && defined(FASTDDS_STATIC_LINK)
39 
40 #if defined(EPROSIMA_ALL_NO_LIB) && !defined(FASTDDS_NO_LIB)
41 #define FASTDDS_NO_LIB
42 #endif // if defined(EPROSIMA_ALL_NO_LIB) && !defined(FASTDDS_NO_LIB)
43 
44 // enable dynamic linking
45 
46 #if defined(_WIN32)
47 #if defined(EPROSIMA_ALL_DYN_LINK) || defined(FASTDDS_DYN_LINK)
48 #if defined(MINGW_COMPILER)
49  #if defined(fastdds_EXPORTS)
50  #define FASTDDS_EXPORTED_API __declspec( dllexport )
51  #else
52  #define FASTDDS_EXPORTED_API __attribute__((visibility("default")))
53  #endif // FASTDDS_SOURCE
54 #else
55  #if defined(fastdds_EXPORTS)
56  #define FASTDDS_EXPORTED_API __declspec( dllexport )
57  #else
58  #define FASTDDS_EXPORTED_API __declspec( dllimport )
59  #endif // FASTDDS_SOURCE
60 #endif // if defined(MINGW_COMPILER)
61 #else
62 #define FASTDDS_EXPORTED_API
63 #endif // if defined(EPROSIMA_ALL_DYN_LINK) || defined(FASTDDS_DYN_LINK)
64 #else
65 #define FASTDDS_EXPORTED_API
66 #endif // _WIN32
67 
68 // Auto linking.
69 
70 #if !defined(FASTDDS_SOURCE) && !defined(EPROSIMA_ALL_NO_LIB) \
71  && !defined(FASTDDS_NO_LIB)
72 
73 // Set properties.
74 #define EPROSIMA_LIB_NAME fastdds
75 
76 #if defined(EPROSIMA_ALL_DYN_LINK) || defined(FASTDDS_DYN_LINK)
77 #define EPROSIMA_DYN_LINK
78 #endif // if defined(EPROSIMA_ALL_DYN_LINK) || defined(FASTDDS_DYN_LINK)
79 
80 #include <fastdds/fastdds_auto_link.hpp>
81 #endif // auto-linking disabled
82 
83 #endif // FASTDDS_FASTDDS_DLL_H