summaryrefslogtreecommitdiffhomepage
path: root/compat/linkage-macros.hpp
blob: dff9a34c585bdeb17bfac068846816c3d493ee88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#pragma once

#if defined _MSC_VER
#   define OTR_GENERIC_EXPORT __declspec(dllexport)
#   define OTR_GENERIC_IMPORT __declspec(dllimport)
#elif defined _WIN32 && !defined __WINE__
#   define OTR_GENERIC_EXPORT __attribute__((dllexport, visibility ("default")))
#   define OTR_GENERIC_IMPORT __attribute__((dllimport, visibility ("default")))
#else
#   define OTR_GENERIC_EXPORT __attribute__((visibility ("default")))
#   define OTR_GENERIC_IMPORT __attribute__((visibility ("default")))
#endif

#if defined __APPLE__ || (defined __MINGW32__ && defined _WIN64)
#   define OTR_NO_TMPL_INST // link failure on both targets
#endif

#if defined OTR_NO_TMPL_INST
#   define OTR_TEMPLATE_IMPORT(x)
#   define OTR_TEMPLATE_EXPORT(x)
#else
#   define OTR_TEMPLATE_IMPORT(x) extern template class OTR_GENERIC_IMPORT x;
#   define OTR_TEMPLATE_EXPORT(x) template class OTR_GENERIC_EXPORT x;
#endif