summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2018-10-05 16:30:22 +0200
committerStanislaw Halik <sthalik@misaki.pl>2018-10-05 14:35:44 +0000
commitd908b5a684a7183e125e84873b1f13aaec804287 (patch)
tree52f555515dd8b585639084d8c3f5da436b7d2a37
parent6eb44ec4831f58e7658efbb0b9f0813629b9cdea (diff)
compat/linkage-macros: fix template exports on mingw-w64
-rw-r--r--compat/linkage-macros.hpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/compat/linkage-macros.hpp b/compat/linkage-macros.hpp
index 77c4502d..ea82c395 100644
--- a/compat/linkage-macros.hpp
+++ b/compat/linkage-macros.hpp
@@ -1,14 +1,17 @@
#pragma once
-#if defined _WIN32 && !defined __WINE__
+#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
#endif
-#if defined __MINGW32__ || defined __APPLE__
+#if defined __APPLE__
# define OTR_TEMPLATE_IMPORT(x) //nothing
#else
# define OTR_TEMPLATE_IMPORT(x) extern template class OTR_GENERIC_IMPORT x
@@ -16,7 +19,7 @@
#define OTR_TEMPLATE_EXPORT_(x) template class OTR_GENERIC_EXPORT x
-#if defined __MINGW32__ || defined __APPLE__
+#if 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)