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

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

#if defined __MINGW32__ || defined __APPLE__
#   define OTR_TEMPLATE_IMPORT(x) //nothing
#else
#   define OTR_TEMPLATE_IMPORT(x) extern template class OTR_GENERIC_IMPORT x
#endif

#define OTR_TEMPLATE_EXPORT_(x) template class OTR_GENERIC_EXPORT x

#if defined __MINGW32__ || defined __APPLE__
#   define OTR_TEMPLATE_EXPORT(x) // nothing
#else /* does this _always_ work for binutils ELF? */
#   define OTR_TEMPLATE_EXPORT(x) OTR_TEMPLATE_EXPORT_(x)
#endif