nros C API
Lightweight ROS 2 client for embedded real-time systems
Loading...
Searching...
No Matches
visibility.h
Go to the documentation of this file.
1
11#ifndef NROS_VISIBILITY_H
12#define NROS_VISIBILITY_H
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
18// Visibility macros for shared library support
19#if defined(_WIN32)
20#if defined(NROS_BUILDING_DLL)
21#define NROS_PUBLIC __declspec(dllexport)
22#elif defined(NROS_USING_DLL)
23#define NROS_PUBLIC __declspec(dllimport)
24#else
25#define NROS_PUBLIC
26#endif
27#define NROS_LOCAL
28#else
29#if __GNUC__ >= 4
30#define NROS_PUBLIC __attribute__((visibility("default")))
31#define NROS_LOCAL __attribute__((visibility("hidden")))
32#else
33#define NROS_PUBLIC
34#define NROS_LOCAL
35#endif
36#endif
37
38// Deprecation macro
39#if defined(__GNUC__) || defined(__clang__)
40#define NROS_DEPRECATED __attribute__((deprecated))
41#elif defined(_MSC_VER)
42#define NROS_DEPRECATED __declspec(deprecated)
43#else
44#define NROS_DEPRECATED
45#endif
46
47// Warn unused result
48#if defined(__GNUC__) || defined(__clang__)
49#define NROS_WARN_UNUSED __attribute__((warn_unused_result))
50#else
51#define NROS_WARN_UNUSED
52#endif
53
54#ifdef __cplusplus
55}
56#endif
57
58#endif // NROS_VISIBILITY_H