ros2_control - humble
Loading...
Searching...
No Matches
visibility_control.h
1// Copyright 2020 PAL Robotics S.L.
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/* This header must be included by all rclcpp headers which declare symbols
16 * which are defined in the rclcpp library. When not building the rclcpp
17 * library, i.e. when using the headers in other package's code, the contents
18 * of this header change the visibility of certain symbols which the rclcpp
19 * library cannot have, but the consuming code must have inorder to link.
20 */
21
22#ifndef VELOCITY_CONTROLLERS__VISIBILITY_CONTROL_H_
23#define VELOCITY_CONTROLLERS__VISIBILITY_CONTROL_H_
24
25// This logic was borrowed (then namespaced) from the examples on the gcc wiki:
26// https://gcc.gnu.org/wiki/Visibility
27
28#if defined _WIN32 || defined __CYGWIN__
29#ifdef __GNUC__
30#define VELOCITY_CONTROLLERS_EXPORT __attribute__((dllexport))
31#define VELOCITY_CONTROLLERS_IMPORT __attribute__((dllimport))
32#else
33#define VELOCITY_CONTROLLERS_EXPORT __declspec(dllexport)
34#define VELOCITY_CONTROLLERS_IMPORT __declspec(dllimport)
35#endif
36#ifdef VELOCITY_CONTROLLERS_BUILDING_DLL
37#define VELOCITY_CONTROLLERS_PUBLIC VELOCITY_CONTROLLERS_EXPORT
38#else
39#define VELOCITY_CONTROLLERS_PUBLIC VELOCITY_CONTROLLERS_IMPORT
40#endif
41#define VELOCITY_CONTROLLERS_PUBLIC_TYPE VELOCITY_CONTROLLERS_PUBLIC
42#define VELOCITY_CONTROLLERS_LOCAL
43#else
44#define VELOCITY_CONTROLLERS_EXPORT __attribute__((visibility("default")))
45#define VELOCITY_CONTROLLERS_IMPORT
46#if __GNUC__ >= 4
47#define VELOCITY_CONTROLLERS_PUBLIC __attribute__((visibility("default")))
48#define VELOCITY_CONTROLLERS_LOCAL __attribute__((visibility("hidden")))
49#else
50#define VELOCITY_CONTROLLERS_PUBLIC
51#define VELOCITY_CONTROLLERS_LOCAL
52#endif
53#define VELOCITY_CONTROLLERS_PUBLIC_TYPE
54#endif
55
56#endif // VELOCITY_CONTROLLERS__VISIBILITY_CONTROL_H_