[gtkmm/use-dllexport: 1/10] gdk/gdkmmconfig.h.[meson|in]: Add GDKMM_API



commit d00f4256934bd887023a171588cb2a0ae5efa31b
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Fri Apr 10 17:37:55 2020 +0800

    gdk/gdkmmconfig.h.[meson|in]: Add GDKMM_API
    
    This enables us to use this macros later in public headers so that we
    can export symbols from the DLLs using compiler directives, instead of
    gendef, if we marked classes and APIs/methods sufficiently.

 gdk/gdkmmconfig.h.in    | 16 ++++++++++++++++
 gdk/gdkmmconfig.h.meson | 16 ++++++++++++++++
 2 files changed, 32 insertions(+)
---
diff --git a/gdk/gdkmmconfig.h.in b/gdk/gdkmmconfig.h.in
index db0076f0..14e68bd2 100644
--- a/gdk/gdkmmconfig.h.in
+++ b/gdk/gdkmmconfig.h.in
@@ -15,4 +15,20 @@
 /* Minor version number of gdkmm. */
 #undef GDKMM_MINOR_VERSION
 
+/* Enable DLL-specific stuff only when not building a static library */
+#if !defined(__CYGWIN__) && defined(_WIN32) && !defined(GDKMM_STATIC_LIB)
+# define GDKMM_DLL 1
+#endif
+
+#ifdef GDKMM_DLL
+# if defined (GDKMM_BUILD) || defined (GTKMM_BUILD)
+#  define GDKMM_API __declspec(dllexport)
+# else
+#  define GDKMM_API __declspec(dllimport)
+# endif /* GDKMM_BUILD */
+#else
+/* Build a static library or a non-native-Windows library */
+# define GDKMM_API
+#endif /* GDKMM_DLL */
+
 #endif /* !_GDKMM_CONFIG_H */
diff --git a/gdk/gdkmmconfig.h.meson b/gdk/gdkmmconfig.h.meson
index 872cc8b1..72850c5e 100644
--- a/gdk/gdkmmconfig.h.meson
+++ b/gdk/gdkmmconfig.h.meson
@@ -15,4 +15,20 @@
 /* Micro version number of gdkmm. */
 #mesondefine GDKMM_MICRO_VERSION
 
+/* Enable DLL-specific stuff only when not building a static library */
+#if !defined(__CYGWIN__) && defined(_WIN32) && !defined(GDKMM_STATIC_LIB)
+# define GDKMM_DLL 1
+#endif
+
+#ifdef GDKMM_DLL
+# if defined (GDKMM_BUILD) || defined (GTKMM_BUILD)
+#  define GDKMM_API __declspec(dllexport)
+# else
+#  define GDKMM_API __declspec(dllimport)
+# endif /* GDKMM_BUILD */
+#else
+/* Build a static library or a non-native-Windows library */
+# define GDKMM_API
+#endif /* GDKMM_DLL */
+
 #endif /* !_GDKMM_CONFIG_H */


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