Module: wine Branch: master Commit: a8c75ad4c6637aa85834d0bff224586e3a7d4229 URL: http://source.winehq.org/git/wine.git/?a=commit;h=a8c75ad4c6637aa85834d0bff2...
Author: Jacek Caban jacek@codeweavers.com Date: Thu Jul 14 17:21:11 2011 +0200
include: Added macros for __uuidof emulation based on C++ templates.
---
include/guiddef.h | 26 ++++++++++++++++++++++++++ 1 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/include/guiddef.h b/include/guiddef.h index f079983..ba8e8cf 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<typename T> 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<type>() { \ + return (const IID){l,w1,w2, {b1,b2,b3,b4,b5,b6,b7,b8}}; \ + } \ + template<> inline const GUID &__wine_uuidof<type*>() { \ + return __wine_uuidof<type>(); \ + } \ + } + +#define __uuidof(type) __wine_uuidof<typeof(type)>() + +#else + +#define __CRT_UUID_DECL(type,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) + +#endif + #endif
#undef DEFINE_GUID