xref: /aosp_15_r20/external/lzma/CPP/Common/MyInitGuid.h (revision f6dc9357d832569d4d1f5d24eacdb3935a1ae8e6)
1 // Common/MyInitGuid.h
2 
3 #ifndef ZIP7_INC_COMMON_MY_INITGUID_H
4 #define ZIP7_INC_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 // #include "Common.h"
23 /* vc6 without sdk needs <objbase.h> before <initguid.h>,
24    but it doesn't work in new msvc.
25    So we include full "MyWindows.h" instead of <objbase.h> */
26 // #include <objbase.h>
27 #include "MyWindows.h"
28 
29 #ifdef _WIN32
30 
31 #ifdef __clang__
32   // #pragma GCC diagnostic ignored "-Wmissing-variable-declarations"
33 #endif
34 
35 #ifdef UNDER_CE
36 #include <basetyps.h>
37 #endif
38 
39 // for vc6 without sdk we must define INITGUID here
40 #define INITGUID
41 #include <initguid.h>
42 
43 #ifdef UNDER_CE
44 DEFINE_GUID(IID_IUnknown,
45 0x00000000, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46);
46 #endif
47 
48 #else // _WIN32
49 
50 #define INITGUID
51 #include "MyGuidDef.h"
52 DEFINE_GUID(IID_IUnknown,
53 0x00000000, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46);
54 
55 #endif // _WIN32
56 
57 #endif
58