• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Common/MyInitGuid.h
2 
3 #ifndef __COMMON_MY_INITGUID_H
4 #define __COMMON_MY_INITGUID_H
5 
6 /*
7 This file must be included only to one C++ file in project before
8 declarations of COM interfaces with DEFINE_GUID macro.
9 
10 Each GUID must be initialized exactly once in project.
11 There are two different versions of the DEFINE_GUID macro in guiddef.h (MyGuidDef.h):
12   - if INITGUID is not defined:  DEFINE_GUID declares an external reference to the symbol name.
13   - if INITGUID is     defined:  DEFINE_GUID initializes the symbol name to the value of the GUID.
14 
15 Also we need IID_IUnknown that is initialized in some file for linking:
16   MSVC:  by default the linker uses some lib file that contains IID_IUnknown
17   MinGW: add -luuid switch for linker
18   WinCE: we define IID_IUnknown in this file
19   Other: we define IID_IUnknown in this file
20 */
21 
22 #ifdef __clang__
23   #pragma clang diagnostic ignored "-Wmissing-variable-declarations"
24 #endif
25 
26 #ifdef _WIN32
27 
28 #ifdef UNDER_CE
29 #include <basetyps.h>
30 #endif
31 
32 #include <InitGuid.h>
33 
34 #ifdef UNDER_CE
35 DEFINE_GUID(IID_IUnknown,
36 0x00000000, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46);
37 #endif
38 
39 #else
40 
41 #define INITGUID
42 #include "MyGuidDef.h"
43 DEFINE_GUID(IID_IUnknown,
44 0x00000000, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46);
45 
46 #endif
47 
48 
49 #endif
50