[cogl] cogl-debug: Mark _cogl_debug_flags with dllexport for MSVC



commit d44e548715da619364d4f82e26e83957af38701d
Author: Neil Roberts <neil linux intel com>
Date:   Thu Nov 24 16:09:16 2011 +0000

    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>

 cogl/cogl-debug.h |    7 ++++++-
 cogl/cogl-util.h  |   13 +++++++++++++
 2 files changed, 19 insertions(+), 1 deletions(-)
---
diff --git a/cogl/cogl-debug.h b/cogl/cogl-debug.h
index 901850f..83534c8 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 256ecae..04e59d0 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);
 



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