[glibmm/fix.gcc.win32.warnings.266] g[io|lib]mmconfig.h.*: Don't dllimport on MinGW




commit a6227b14ef8a1941cf4e84787feeab6fc0a31994
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Mon Mar 8 12:01:43 2021 +0800

    g[io|lib]mmconfig.h.*: Don't dllimport on MinGW
    
    This will fix warnings when building items using glibmm and giomm with
    MinGW/GCC.
    
    Please see: https://gitlab.gnome.org/GNOME/gtkmm/-/issues/90

 gio/giommconfig.h.in      | 4 +++-
 gio/giommconfig.h.meson   | 4 +++-
 glib/glibmmconfig.h.in    | 4 +++-
 glib/glibmmconfig.h.meson | 4 +++-
 4 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/gio/giommconfig.h.in b/gio/giommconfig.h.in
index b9579c6e..363237ea 100644
--- a/gio/giommconfig.h.in
+++ b/gio/giommconfig.h.in
@@ -26,8 +26,10 @@
 #ifdef GIOMM_DLL
 # if defined(GIOMM_BUILD)
 #  define GIOMM_API __declspec(dllexport)
-# else
+# elif !defined (__GNUC__)
 #  define GIOMM_API __declspec(dllimport)
+# else /* don't dllimport classes/methods unless needed on GCC/MinGW */
+#  define GIOMM_API
 # endif
 /* Build a static library or non-native-Windows library */
 #else
diff --git a/gio/giommconfig.h.meson b/gio/giommconfig.h.meson
index 9ac31c6d..d8cbf945 100644
--- a/gio/giommconfig.h.meson
+++ b/gio/giommconfig.h.meson
@@ -26,8 +26,10 @@
 #ifdef GIOMM_DLL
 # if defined(GIOMM_BUILD)
 #  define GIOMM_API __declspec(dllexport)
-# else
+# elif !defined (__GNUC__)
 #  define GIOMM_API __declspec(dllimport)
+# else /* don't dllimport classes/methods unless needed on GCC/MinGW */
+#  define GIOMM_API
 # endif
 /* Build a static library or non-native-Windows library */
 #else
diff --git a/glib/glibmmconfig.h.in b/glib/glibmmconfig.h.in
index ef82084f..9993042e 100644
--- a/glib/glibmmconfig.h.in
+++ b/glib/glibmmconfig.h.in
@@ -138,8 +138,10 @@
 #ifdef GLIBMM_DLL
 # if defined(GLIBMM_BUILD)
 #  define GLIBMM_API __declspec(dllexport)
-# else
+# elif !defined (__GNUC__)
 #  define GLIBMM_API __declspec(dllimport)
+# else /* don't dllimport classes/methods unless needed on GCC/MinGW */
+#  define GLIBMM_API
 # endif /* GLIBMM_BUILD - _WINDLL */
 #else
 /* Build a static library or a non-native-Windows library */
diff --git a/glib/glibmmconfig.h.meson b/glib/glibmmconfig.h.meson
index 6fff5057..009ea37f 100644
--- a/glib/glibmmconfig.h.meson
+++ b/glib/glibmmconfig.h.meson
@@ -138,8 +138,10 @@
 #ifdef GLIBMM_DLL
 # if defined(GLIBMM_BUILD)
 #  define GLIBMM_API __declspec(dllexport)
-# else
+# elif !defined (__GNUC__)
 #  define GLIBMM_API __declspec(dllimport)
+# else /* don't dllimport classes/methods unless needed on GCC/MinGW */
+#  define GLIBMM_API
 # endif /* GLIBMM_BUILD - _WINDLL */
 #else
 /* Build a static library or a non-native-Windows library */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]