when mingw is mingw64, it appears that we need to use __declspec() and not __attribut...
[ardour.git] / libs / evoral / evoral / visibility.h
index 380caca2fd8454edc1c45ae7077daa37316dbfe1..32e410b3aba39a26641ca7f6ebc096691f3df060 100644 (file)
 #ifndef __libevoral_visibility_h__
 #define __libevoral_visibility_h__
 
-/* _WIN32 is defined by most compilers targetting Windows, but within the
- * evoral source tree, we also define COMPILER_MSVC or COMPILER_MINGW depending
- * on how a Windows build is built.
- */
-
-#if defined _WIN32 || defined __CYGWIN__ || defined(COMPILER_MSVC) || defined(COMPILER_MINGW)
+#if defined(COMPILER_MSVC) || defined(__MINGW64__)
   #define LIBEVORAL_DLL_IMPORT __declspec(dllimport)
   #define LIBEVORAL_DLL_EXPORT __declspec(dllexport)
   #define LIBEVORAL_DLL_LOCAL
+  #define LIBEVORAL_TEMPLATE_DLL_IMPORT
+  #define LIBEVORAL_TEMPLATE_DLL_EXPORT
 #else
-  #if __GNUC__ >= 4
-    #define LIBEVORAL_DLL_IMPORT __attribute__ ((visibility ("default")))
-    #define LIBEVORAL_DLL_EXPORT __attribute__ ((visibility ("default")))
-    #define LIBEVORAL_DLL_LOCAL  __attribute__ ((visibility ("hidden")))
-  #else
-    #define LIBEVORAL_DLL_IMPORT
-    #define LIBEVORAL_DLL_EXPORT
-    #define LIBEVORAL_DLL_LOCAL
-  #endif
+  #define LIBEVORAL_DLL_IMPORT __attribute__ ((visibility ("default")))
+  #define LIBEVORAL_DLL_EXPORT __attribute__ ((visibility ("default")))
+  #define LIBEVORAL_DLL_LOCAL  __attribute__ ((visibility ("hidden")))
+  #define LIBEVORAL_TEMPLATE_DLL_IMPORT __attribute__ ((visibility ("default")))
+  #define LIBEVORAL_TEMPLATE_DLL_EXPORT __attribute__ ((visibility ("default")))
 #endif
 
-#ifdef LIBEVORAL_DLL // libevoral is a DLL
-#ifdef LIBEVORAL_DLL_EXPORTS // defined if we are building the libevoral DLL (instead of using it)
-    #define LIBEVORAL_API LIBEVORAL_DLL_EXPORT
+#ifdef LIBEVORAL_STATIC // libevoral is not a DLL
+  #define LIBEVORAL_API
+  #define LIBEVORAL_LOCAL
 #else
+  #ifdef LIBEVORAL_DLL_EXPORTS // defined if we are building the libevoral DLL (instead of using it)
+    #define LIBEVORAL_API LIBEVORAL_DLL_EXPORT
+    #define LIBEVORAL_TEMPLATE_API LIBEVORAL_TEMPLATE_DLL_EXPORT
+  #else
     #define LIBEVORAL_API LIBEVORAL_DLL_IMPORT
-#endif 
-#define     LIBEVORAL_LOCAL LIBEVORAL_DLL_LOCAL
-#else /* static lib, not DLL */
-#define LIBEVORAL_API
-#define LIBEVORAL_LOCAL
+    #define LIBEVORAL_TEMPLATE_API LIBEVORAL_TEMPLATE_DLL_IMPORT
+  #endif 
+  #define     LIBEVORAL_LOCAL LIBEVORAL_DLL_LOCAL
 #endif
 
 #endif /* __libevoral_visibility_h__ */