libfilezilla
visibility_helper.hpp
1 #ifndef LIBFILEZILLA_VISIBILITY_HELPER_HEADER
2 #define LIBFILEZILLA_VISIBILITY_HELPER_HEADER
3 
4 #include "private/defs.hpp"
5 
6 // Symbol visibility. There are two main cases: Building a library and using it.
7 // For building, symbols need to be marked as export, for using it they
8 // need to be imported.
9 
10 // Two cases when building: Windows, other platform
11 #ifdef FZ_WINDOWS
12 
13  // Under Windows we can either use Visual Studio or a proper compiler
14  #ifdef _MSC_VER
15  #ifdef DLL_EXPORT
16  #define FZ_EXPORT_PUBLIC __declspec(dllexport)
17  #else
18  #define FZ_EXPORT_PUBLIC
19  #endif
20  #define FZ_EXPORT_PRIVATE
21  #else
22  #ifdef DLL_EXPORT
23  #define FZ_EXPORT_PUBLIC __declspec(dllexport)
24  #define FZ_EXPORT_PRIVATE
25  #else
26  #define FZ_EXPORT_PUBLIC __attribute__((visibility("default")))
27  #define FZ_EXPORT_PRIVATE __attribute__((visibility("hidden")))
28  #endif
29  #endif
30 
31 #else
32 
33  #define FZ_EXPORT_PUBLIC __attribute__((visibility("default")))
34  #define FZ_EXPORT_PRIVATE __attribute__((visibility("hidden")))
35 
36 #endif
37 
38 
39 // Under MSW it makes a difference whether we use a static library or a DLL
40 #if defined(FZ_WINDOWS)
41  #define FZ_IMPORT_SHARED __declspec(dllimport)
42 #else
43  #define FZ_IMPORT_SHARED
44 #endif
45 #define FZ_IMPORT_STATIC
46 
47 #endif