rcl_logging_spdlog  master
Implementation of rcl_logging API for an spdlog backend.
All Files Functions Enumerations Enumerator Macros Pages
visibility_control.h
Go to the documentation of this file.
1 // Copyright 2020 Open Source Robotics Foundation, Inc.
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 
15 #ifndef RCL_LOGGING_INTERFACE__VISIBILITY_CONTROL_H_
16 #define RCL_LOGGING_INTERFACE__VISIBILITY_CONTROL_H_
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 // This logic was borrowed (then namespaced) from the examples on the gcc wiki:
23 // https://gcc.gnu.org/wiki/Visibility
24 
25 #if defined _WIN32 || defined __CYGWIN__
26  #ifdef __GNUC__
27  #define RCL_LOGGING_INTERFACE_EXPORT __attribute__ ((dllexport))
28  #define RCL_LOGGING_INTERFACE_IMPORT __attribute__ ((dllimport))
29  #else
30  #define RCL_LOGGING_INTERFACE_EXPORT __declspec(dllexport)
31  #define RCL_LOGGING_INTERFACE_IMPORT __declspec(dllimport)
32  #endif
33  #ifdef RCL_LOGGING_INTERFACE_BUILDING_DLL
34  #define RCL_LOGGING_INTERFACE_PUBLIC RCL_LOGGING_INTERFACE_EXPORT
35  #else
36  #define RCL_LOGGING_INTERFACE_PUBLIC RCL_LOGGING_INTERFACE_IMPORT
37  #endif
38  #define RCL_LOGGING_INTERFACE_PUBLIC_TYPE RCL_LOGGING_INTERFACE_PUBLIC
39  #define RCL_LOGGING_INTERFACE_LOCAL
40 #else
41  #define RCL_LOGGING_INTERFACE_EXPORT __attribute__ ((visibility("default")))
42  #define RCL_LOGGING_INTERFACE_IMPORT
43  #if __GNUC__ >= 4
44  #define RCL_LOGGING_INTERFACE_PUBLIC __attribute__ ((visibility("default")))
45  #define RCL_LOGGING_INTERFACE_LOCAL __attribute__ ((visibility("hidden")))
46  #else
47  #define RCL_LOGGING_INTERFACE_PUBLIC
48  #define RCL_LOGGING_INTERFACE_LOCAL
49  #endif
50  #define RCL_LOGGING_INTERFACE_PUBLIC_TYPE
51 #endif
52 
53 #ifdef __cplusplus
54 }
55 #endif
56 
57 #endif // RCL_LOGGING_INTERFACE__VISIBILITY_CONTROL_H_