summaryrefslogtreecommitdiff
path: root/librsvg-features.h.in
diff options
context:
space:
mode:
authorChun-wei Fan <fanchunwei@src.gnome.org>2015-08-12 18:07:21 +0800
committerChun-wei Fan <fanchunwei@src.gnome.org>2015-09-25 20:27:36 +0800
commit885938629be08e21b6ce3b3fbdf45a288cc6c21f (patch)
tree323a108973f26f4a4417f3a8236bfe29a5aae95b /librsvg-features.h.in
parent741b8d9e41520e0d6717ace0a36c4ca4a768b97b (diff)
downloadlibrsvg-885938629be08e21b6ce3b3fbdf45a288cc6c21f.tar.gz
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
Diffstat (limited to 'librsvg-features.h.in')
-rw-r--r--librsvg-features.h.in26
1 files changed, 24 insertions, 2 deletions
diff --git a/librsvg-features.h.in b/librsvg-features.h.in
index c682d3b9..8950ed60 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