From a8c75ad4c6637aa85834d0bff224586e3a7d4229 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Thu, 14 Jul 2011 17:21:11 +0200 Subject: [PATCH] include: Added macros for __uuidof emulation based on C++ templates. --- include/guiddef.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/include/guiddef.h b/include/guiddef.h index f0799830f88..ba8e8cf4c2c 100644 --- a/include/guiddef.h +++ b/include/guiddef.h @@ -29,6 +29,32 @@ typedef struct _GUID unsigned short Data3; unsigned char Data4[ 8 ]; } GUID; + +/* Macros for __uuidof emulation */ +#if defined(__cplusplus) && !defined(_MSC_VER) + +extern "C++" { + template const GUID &__wine_uuidof(); +} + +#define __CRT_UUID_DECL(type,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \ + extern "C++" { \ + template<> inline const GUID &__wine_uuidof() { \ + return (const IID){l,w1,w2, {b1,b2,b3,b4,b5,b6,b7,b8}}; \ + } \ + template<> inline const GUID &__wine_uuidof() { \ + return __wine_uuidof(); \ + } \ + } + +#define __uuidof(type) __wine_uuidof() + +#else + +#define __CRT_UUID_DECL(type,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) + +#endif + #endif #undef DEFINE_GUID