[flac-dev] make dllimport/dllexport attributes work with mingw (and others)

Ozkan Sezer sezeroz at gmail.com
Fri May 23 23:16:15 PDT 2014


The following patch changes export.h so that the dllimport/dllexport
attributes work with mingw/mingw-w64 and others:
- changes _declspec keyword to __declspec: the former may not be
  defined by some toolchains.
- changes the _MSC_VER condition to universally _WIN32: MSVC, as well
  as GCC supports this.

Attached patch: declspec.diff

Regards.

--
O.S.
-------------- next part --------------
diff --git a/include/FLAC/export.h b/include/FLAC/export.h
index 2232b41..4b2418f 100644
--- a/include/FLAC/export.h
+++ b/include/FLAC/export.h
@@ -59,11 +59,11 @@
 #if defined(FLAC__NO_DLL)
 #define FLAC_API
 
-#elif defined(_MSC_VER)
+#elif defined(_WIN32) /*defined(_MSC_VER)*/
 #ifdef FLAC_API_EXPORTS
-#define	FLAC_API	_declspec(dllexport)
+#define FLAC_API __declspec(dllexport)
 #else
-#define FLAC_API	_declspec(dllimport)
+#define FLAC_API __declspec(dllimport)
 #endif
 
 #elif defined(FLAC__USE_VISIBILITY_ATTR)
diff --git a/include/FLAC++/export.h b/include/FLAC++/export.h
index 11c09e6..ab9b439 100644
--- a/include/FLAC++/export.h
+++ b/include/FLAC++/export.h
@@ -59,11 +59,11 @@
 #if defined(FLAC__NO_DLL)
 #define FLACPP_API
 
-#elif defined(_MSC_VER)
+#elif defined(_WIN32) /*defined(_MSC_VER)*/
 #ifdef FLACPP_API_EXPORTS
-#define	FLACPP_API	_declspec(dllexport)
+#define FLACPP_API __declspec(dllexport)
 #else
-#define FLACPP_API	_declspec(dllimport)
+#define FLACPP_API __declspec(dllimport)
 #endif
 
 #elif defined(FLAC__USE_VISIBILITY_ATTR)


More information about the flac-dev mailing list