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>
This commit is contained in:
Neil Roberts 2011-11-24 16:09:16 +00:00
parent 2055f6ba91
commit d44e548715
2 changed files with 19 additions and 1 deletions

View File

@ -26,6 +26,7 @@
#include "cogl-profile.h" #include "cogl-profile.h"
#include "cogl-flags.h" #include "cogl-flags.h"
#include "cogl-util.h"
#include <glib.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) #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; extern GHashTable *_cogl_debug_instances;
#define COGL_DEBUG_ENABLED(flag) \ #define COGL_DEBUG_ENABLED(flag) \

View File

@ -32,6 +32,19 @@
#include <stdio.h> #include <stdio.h>
#endif #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 int
_cogl_util_next_p2 (int a); _cogl_util_next_p2 (int a);