unilink  0.4.3
A simple C++ library for unified async communication
visibility.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2025 Jinwoo Sung
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #if __has_include(<unilink_export.hpp>)
20 #include <unilink_export.hpp>
21 #endif
22 
23 #if !defined(UNILINK_API)
24 #if defined(UNILINK_BUILD_SHARED)
25 #if defined(_WIN32) || defined(__CYGWIN__)
26 #if defined(UNILINK_BUILDING_LIBRARY)
27 #define UNILINK_API __declspec(dllexport)
28 #else
29 #define UNILINK_API __declspec(dllimport)
30 #endif
31 #else
32 #define UNILINK_API __attribute__((visibility("default")))
33 #endif
34 #elif defined(UNILINK_EXPORT)
35 #define UNILINK_API UNILINK_EXPORT
36 #else
37 #define UNILINK_API
38 #endif
39 #endif
40 
41 #if !defined(UNILINK_LOCAL)
42 #if defined(UNILINK_NO_EXPORT)
43 #define UNILINK_LOCAL UNILINK_NO_EXPORT
44 #elif defined(_WIN32) || defined(__CYGWIN__)
45 #define UNILINK_LOCAL
46 #else
47 #define UNILINK_LOCAL __attribute__((visibility("hidden")))
48 #endif
49 #endif
50 
51 #ifndef UNILINK_EXPORT
52 #define UNILINK_EXPORT UNILINK_API
53 #endif
54 
55 #ifndef UNILINK_NO_EXPORT
56 #define UNILINK_NO_EXPORT UNILINK_LOCAL
57 #endif