Autoware.Auto
drivers/lgsvl_interface/include/lgsvl_interface/visibility_control.hpp
Go to the documentation of this file.
1 // Copyright 2020 the Autoware Foundation
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 // Co-developed by Tier IV, Inc. and Apex.AI, Inc.
18 #ifndef LGSVL_INTERFACE__VISIBILITY_CONTROL_HPP_
19 #define LGSVL_INTERFACE__VISIBILITY_CONTROL_HPP_
20 
21 // This logic was borrowed (then namespaced) from the examples on the gcc wiki:
22 // https://gcc.gnu.org/wiki/Visibility
23 
24 #if defined _WIN32 || defined __CYGWIN__
25  #ifdef __GNUC__
26  #define LGSVL_INTERFACE_EXPORT __attribute__ ((dllexport))
27  #define LGSVL_INTERFACE_IMPORT __attribute__ ((dllimport))
28  #else
29  #define LGSVL_INTERFACE_EXPORT __declspec(dllexport)
30  #define LGSVL_INTERFACE_IMPORT __declspec(dllimport)
31  #endif
32  #ifdef LGSVL_INTERFACE_BUILDING_LIBRARY
33  #define LGSVL_INTERFACE_PUBLIC LGSVL_INTERFACE_EXPORT
34  #else
35  #define LGSVL_INTERFACE_PUBLIC LGSVL_INTERFACE_IMPORT
36  #endif
37  #define LGSVL_INTERFACE_PUBLIC_TYPE LGSVL_INTERFACE_PUBLIC
38  #define LGSVL_INTERFACE_LOCAL
39 #else
40  #define LGSVL_INTERFACE_EXPORT __attribute__ ((visibility("default")))
41  #define LGSVL_INTERFACE_IMPORT
42  #if __GNUC__ >= 4
43  #define LGSVL_INTERFACE_PUBLIC __attribute__ ((visibility("default")))
44  #define LGSVL_INTERFACE_LOCAL __attribute__ ((visibility("hidden")))
45  #else
46  #define LGSVL_INTERFACE_PUBLIC
47  #define LGSVL_INTERFACE_LOCAL
48  #endif
49  #define LGSVL_INTERFACE_PUBLIC_TYPE
50 #endif
51 
52 #endif // LGSVL_INTERFACE__VISIBILITY_CONTROL_HPP_