cogl/cogl-debug.h: Export and properly use extern variables

We need to export the extern variables _cogl_debug_instances and
_cogl_debug_flags for their consumption in Cogl-Pango and Cogl-Path,
so that these variables can be properly referred to by these libraries,
and hence any other libraries that make use of them, such as Clutter.

On Visual Studio DLL builds, these variables *must* also be marked
with __declspec(dllimport) when Cogl-Path and Cogl-Pango is being built
against Cogl so that they can be referred to properly, otherwise one will
be subject to crashes as a result.
This commit is contained in:
Chun-wei Fan 2019-02-13 17:36:22 +08:00
parent 50add85a26
commit e2eff444ef
1 changed files with 5 additions and 4 deletions

View File

@ -79,12 +79,13 @@ typedef enum {
COGL_DEBUG_N_FLAGS
} CoglDebugFlags;
extern GHashTable *_cogl_debug_instances;
/* _cogl_debug_flags and _cogl_debug_instances currently needs to exported
* outside of the shared library for cogl-pango and cogl-path. The special
* COGL_EXPORT macro is needed to get this to work when building with MSVC.
*/
COGL_EXPORT extern GHashTable *_cogl_debug_instances;
#define COGL_DEBUG_N_LONGS COGL_FLAGS_N_LONGS_FOR_SIZE (COGL_DEBUG_N_FLAGS)
/* _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];
#define COGL_DEBUG_ENABLED(flag) \