summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--compat/linkage-macros.hpp20
-rw-r--r--options/value.cpp3
-rw-r--r--options/value.hpp40
3 files changed, 32 insertions, 31 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
diff --git a/options/value.cpp b/options/value.cpp
index 0e0725f8..e0be69ae 100644
--- a/options/value.cpp
+++ b/options/value.cpp
@@ -1,5 +1,6 @@
// instantiate the "template class" value<t> symbols
-#define OTR_INST_VALUE OTR_TEMPLATE_EXPORT
+#include "compat/linkage-macros.hpp"
+#define OTR_INST_VALUE(x) OTR_TEMPLATE_EXPORT(x)
#include "value.hpp"
diff --git a/options/value.hpp b/options/value.hpp
index 7c0a8d56..bfa8b352 100644
--- a/options/value.hpp
+++ b/options/value.hpp
@@ -150,27 +150,25 @@ public:
};
// some linker problems
-#if !defined __APPLE__
-# if !defined OTR_INST_VALUE
-# define OTR_INST_VALUE OTR_TEMPLATE_IMPORT
-# endif
-
- OTR_INST_VALUE(value<double>);
- OTR_INST_VALUE(value<float>);
- OTR_INST_VALUE(value<int>);
- OTR_INST_VALUE(value<bool>);
- OTR_INST_VALUE(value<QString>);
- OTR_INST_VALUE(value<slider_value>);
- OTR_INST_VALUE(value<QPointF>);
- OTR_INST_VALUE(value<QVariant>);
- OTR_INST_VALUE(value<QList<double>>);
- OTR_INST_VALUE(value<QList<float>>);
- OTR_INST_VALUE(value<QList<int>>);
- OTR_INST_VALUE(value<QList<bool>>);
- OTR_INST_VALUE(value<QList<QString>>);
- OTR_INST_VALUE(value<QList<slider_value>>);
- OTR_INST_VALUE(value<QList<QPointF>>);
- OTR_INST_VALUE(value<QList<QVariant>>);
+#if !defined OTR_INST_VALUE
+# define OTR_INST_VALUE OTR_TEMPLATE_IMPORT
#endif
+OTR_INST_VALUE(value<double>);
+OTR_INST_VALUE(value<float>);
+OTR_INST_VALUE(value<int>);
+OTR_INST_VALUE(value<bool>);
+OTR_INST_VALUE(value<QString>);
+OTR_INST_VALUE(value<slider_value>);
+OTR_INST_VALUE(value<QPointF>);
+OTR_INST_VALUE(value<QVariant>);
+OTR_INST_VALUE(value<QList<double>>);
+OTR_INST_VALUE(value<QList<float>>);
+OTR_INST_VALUE(value<QList<int>>);
+OTR_INST_VALUE(value<QList<bool>>);
+OTR_INST_VALUE(value<QList<QString>>);
+OTR_INST_VALUE(value<QList<slider_value>>);
+OTR_INST_VALUE(value<QList<QPointF>>);
+OTR_INST_VALUE(value<QList<QVariant>>);
+
} // ns options