summaryrefslogtreecommitdiffhomepage
path: root/compat/linkage-macros.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2018-08-27 16:58:01 +0200
committerStanislaw Halik <sthalik@misaki.pl>2018-08-27 16:58:01 +0200
commit87929a9a2168b1634be69fbdcf97d1a41167de6a (patch)
tree6c05f82813eafc3bfbce2dcd92bdf4b43bc61dd3 /compat/linkage-macros.hpp
parent2ec151886274452fd54024302f5f71760a9665d5 (diff)
compat/linkage-macros: simplify
Diffstat (limited to 'compat/linkage-macros.hpp')
-rw-r--r--compat/linkage-macros.hpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/compat/linkage-macros.hpp b/compat/linkage-macros.hpp
index 967dfba9..77c4502d 100644
--- a/compat/linkage-macros.hpp
+++ b/compat/linkage-macros.hpp
@@ -1,21 +1,23 @@
#pragma once
-#if defined _MSC_VER
+#if defined _WIN32 && !defined __WINE__
# 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))
#else
# define OTR_GENERIC_EXPORT __attribute__ ((visibility ("default")))
# define OTR_GENERIC_IMPORT
#endif
-#define OTR_TEMPLATE_IMPORT(x) extern template class OTR_GENERIC_IMPORT x
+#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 _MSC_VER
-# define OTR_TEMPLATE_EXPORT OTR_TEMPLATE_EXPORT_
-#else
-# define OTR_TEMPLATE_EXPORT OTR_TEMPLATE_EXPORT_
+#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