UPnPsdk 0.1
Universal Plug and Play +, Software Development Kit
 
Loading...
Searching...
No Matches
visibility.hpp
Go to the documentation of this file.
1#ifndef UPnPsdk_INCLUDE_VISIBILITY_HPP
2#define UPnPsdk_INCLUDE_VISIBILITY_HPP
3// Copyright (C) 2022 GPL 3 and higher by Ingo Höft, <Ingo@Hoeft-online.de>
4// Redistribution only with this Copyright remark. Last modified: 2025-06-12
26// C++ visibility support
27//-----------------------
28// clang-format off
30// Generic helper definitions for shared library support
31#if defined _WIN32 || defined __CYGWIN__
32 #define UPNP_HELPER_DLL_IMPORT __declspec(dllimport)
33 #define UPNP_HELPER_DLL_EXPORT __declspec(dllexport)
34 #define UPNP_HELPER_DLL_LOCAL
35#else
36 #if __GNUC__ >= 4
37 #define UPNP_HELPER_DLL_IMPORT __attribute__ ((visibility ("default")))
38 #define UPNP_HELPER_DLL_EXPORT __attribute__ ((visibility ("default")))
39 #define UPNP_HELPER_DLL_LOCAL __attribute__ ((visibility ("hidden")))
40 #else
41 #define UPNP_HELPER_DLL_IMPORT
42 #define UPNP_HELPER_DLL_EXPORT
43 #define UPNP_HELPER_DLL_LOCAL
44 #endif
45#endif
47
48// Now we use the generic helper definitions above to define UPnPsdk_VIS and
49// UPnPsdk_LOCAL. UPnPsdk_VIS is used for the public visible symbols. It either
50// DLL imports or DLL exports (or does nothing for static build) UPnPsdk_LOCAL
51// is used for non-api symbols.
52
53#ifdef UPnPsdk_SHARE // defined if UPnPsdk is compiled as a shared library
54 #ifdef UPnPsdk_EXPORTS // defined if we are building the UPnPsdk DLL (instead of using it)
55 #define UPnPsdk_VIS UPNP_HELPER_DLL_EXPORT
56 #else
57 #define UPnPsdk_VIS UPNP_HELPER_DLL_IMPORT
58 #endif // UPnPsdk_EXPORTS
59 #define UPnPsdk_LOCAL UPNP_HELPER_DLL_LOCAL
60#else // UPnPsdk_SHARE is not defined: this means UPnPsdk is a static lib.
61 #define UPnPsdk_VIS
62 #define UPnPsdk_LOCAL
63#endif // UPnPsdk_SHARE
64
65#if (defined _WIN32 || defined __CYGWIN__) && defined UPnPsdk_SHARE
66 #define UPnPsdk_EXTERN __declspec(dllimport) extern
67#else
68 #define UPnPsdk_EXTERN UPnPsdk_VIS extern
69#endif
70
72// Its all the same symbol export but only for its different meanings.
73#define PUPNP_Api UPnPsdk_VIS // Symbol exports for old pupnp API.
74#define UPnPsdk_API UPnPsdk_VIS // Symbol exports for UPnPsdk internal use only.
76
77// clang-format on
78
79#endif // UPnPsdk_INCLUDE_VISIBILITY_HPP