[librsvg] librsvg-features.h.in: Fix Public Variable Declaration
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg] librsvg-features.h.in: Fix Public Variable Declaration
- Date: Fri, 25 Sep 2015 12:29:48 +0000 (UTC)
commit 885938629be08e21b6ce3b3fbdf45a288cc6c21f
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Wed Aug 12 18:07:21 2015 +0800
librsvg-features.h.in: Fix Public Variable Declaration
... on Windows, as public variables need to be decorated for export and
import so that they can be linked to and referred to properly, when
building librsvg as a DLL. This is the same thing that is done in GLib.
https://bugzilla.gnome.org/show_bug.cgi?id=753555
librsvg-features.h.in | 26 ++++++++++++++++++++++++--
1 files changed, 24 insertions(+), 2 deletions(-)
---
diff --git a/librsvg-features.h.in b/librsvg-features.h.in
index c682d3b..8950ed6 100644
--- a/librsvg-features.h.in
+++ b/librsvg-features.h.in
@@ -22,7 +22,29 @@
#define LIBRSVG_CHECK_FEATURE(FEATURE) (defined(LIBRSVG_HAVE_##FEATURE) && LIBRSVG_HAVE_##FEATURE)
#endif
-extern const guint librsvg_major_version, librsvg_minor_version, librsvg_micro_version;
-extern const char librsvg_version[];
+/*
+ * On Windows builds, we need to decorate variables that are exposed in the public API
+ * so that they can be properly exported and linked to, for DLL builds
+ */
+#ifndef RSVG_VAR
+# ifdef G_PLATFORM_WIN32
+# ifndef RSVG_STATIC
+# ifdef RSVG_COMPILATION
+# define RSVG_VAR extern __declspec (dllexport)
+# else /* RSVG_COMPILATION */
+# define RSVG_VAR extern __declspec (dllimport)
+# endif /* !RSVG_COMPILATION */
+# else /* !RSVG_STATIC */
+# define RSVG_VAR extern
+# endif /* RSVG_STATIC */
+# else /* G_PLATFORM_WIN32 */
+# define RSVG_VAR extern
+# endif /* !G_PLATFORM_WIN32 */
+#endif
+
+RSVG_VAR const guint librsvg_major_version;
+RSVG_VAR const guint librsvg_minor_version;
+RSVG_VAR const guint librsvg_micro_version;
+RSVG_VAR const char librsvg_version[];
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]