• 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 _WIN32
23 
24 #ifdef UNDER_CE
25 #include <basetyps.h>
26 #endif
27 
28 #include <initguid.h>
29 
30 #ifdef UNDER_CE
31 DEFINE_GUID(IID_IUnknown,
32 0x00000000, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46);
33 #endif
34 
35 #else
36 
37 #define INITGUID
38 #include "MyGuidDef.h"
39 DEFINE_GUID(IID_IUnknown,
40 0x00000000, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46);
41 
42 #endif
43 
44 
45 #endif
46