summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Roberts <neil@linux.intel.com>2011-11-24 16:09:16 +0000
committerNeil Roberts <neil@linux.intel.com>2011-11-25 13:14:10 +0000
commitd44e548715da619364d4f82e26e83957af38701d (patch)
tree54d886d6a2407de3797611f626dc1218faecef71
parent2055f6ba91d192073eaa0dbacf43bbdc160baec8 (diff)
downloadcogl-d44e548715da619364d4f82e26e83957af38701d.tar.gz
cogl-debug: Mark _cogl_debug_flags with dllexport for MSVC
When building with MSVC, symbols to be exported that point to data need to be marked with dllimport to be successfully imported. The _cogl_debug_flags variable is currently exported because it is used from cogl-pango. This patch adds a COGL_EXPORT macro to cogl-util.h which is used in cogl-debug.h Based on a patch by Chun-wei Fan https://bugzilla.gnome.org/show_bug.cgi?id=650020 Reviewed-by: Robert Bragg <robert@linux.intel.com>
-rw-r--r--cogl/cogl-debug.h7
-rw-r--r--cogl/cogl-util.h13
2 files changed, 19 insertions, 1 deletions
diff --git a/cogl/cogl-debug.h b/cogl/cogl-debug.h
index 901850f7..83534c84 100644
--- a/cogl/cogl-debug.h
+++ b/cogl/cogl-debug.h
@@ -26,6 +26,7 @@
#include "cogl-profile.h"
#include "cogl-flags.h"
+#include "cogl-util.h"
#include <glib.h>
@@ -74,7 +75,11 @@ typedef enum {
#define COGL_DEBUG_N_LONGS COGL_FLAGS_N_LONGS_FOR_SIZE (COGL_DEBUG_N_FLAGS)
-extern unsigned long _cogl_debug_flags[COGL_DEBUG_N_LONGS];
+/* _cogl_debug_flags currently needs to exported outside of the shared
+ library for cogl-pango. The special COGL_EXPORT macro is needed to
+ get this to work when building with MSVC */
+COGL_EXPORT extern unsigned long _cogl_debug_flags[COGL_DEBUG_N_LONGS];
+
extern GHashTable *_cogl_debug_instances;
#define COGL_DEBUG_ENABLED(flag) \
diff --git a/cogl/cogl-util.h b/cogl/cogl-util.h
index 256ecaea..04e59d02 100644
--- a/cogl/cogl-util.h
+++ b/cogl/cogl-util.h
@@ -32,6 +32,19 @@
#include <stdio.h>
#endif
+/* When compiling with Visual Studio, symbols that represent data that
+ are exported out of the DLL need to be marked with the dllexport
+ attribute. */
+#ifdef _MSC_VER
+#ifdef COGL_BUILD_EXP
+#define COGL_EXPORT __declspec(dllexport)
+#else
+#define COGL_EXPORT __declspec(dllimport)
+#endif
+#else
+#define COGL_EXPORT
+#endif
+
int
_cogl_util_next_p2 (int a);