From 7d19bf5d619fb50b53dbc6c9ea4bc8bd04c448f3 Mon Sep 17 00:00:00 2001 From: Troy Rollo Date: Fri, 2 Sep 2005 12:17:52 +0000 Subject: [PATCH] For C++, declare initialised GUIDs to be "extern const" rather than just "const" to ensure that the initialised GUID is visible to other modules, and use EXTERN_C rather than just "extern" for the benefit of MSVC++, which does name mangling on global variables. --- include/guiddef.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/include/guiddef.h b/include/guiddef.h index 3cbb3e1c7dc..1cda4f757d0 100644 --- a/include/guiddef.h +++ b/include/guiddef.h @@ -35,12 +35,18 @@ typedef const GUID *LPCGUID; #undef DEFINE_GUID #ifdef INITGUID +#ifdef __cplusplus #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ - const GUID name = \ + EXTERN_C const GUID name = \ { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } } #else #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ - extern const GUID name + const GUID name = \ + { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } } +#endif +#else +#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ + EXTERN_C const GUID name #endif #define DEFINE_OLEGUID(name, l, w1, w2) \