xref: /aosp_15_r20/external/lzma/CPP/Common/MyInitGuid.h (revision f6dc9357d832569d4d1f5d24eacdb3935a1ae8e6)
1*f6dc9357SAndroid Build Coastguard Worker // Common/MyInitGuid.h
2*f6dc9357SAndroid Build Coastguard Worker 
3*f6dc9357SAndroid Build Coastguard Worker #ifndef ZIP7_INC_COMMON_MY_INITGUID_H
4*f6dc9357SAndroid Build Coastguard Worker #define ZIP7_INC_COMMON_MY_INITGUID_H
5*f6dc9357SAndroid Build Coastguard Worker 
6*f6dc9357SAndroid Build Coastguard Worker /*
7*f6dc9357SAndroid Build Coastguard Worker This file must be included only to one C++ file in project before
8*f6dc9357SAndroid Build Coastguard Worker declarations of COM interfaces with DEFINE_GUID macro.
9*f6dc9357SAndroid Build Coastguard Worker 
10*f6dc9357SAndroid Build Coastguard Worker Each GUID must be initialized exactly once in project.
11*f6dc9357SAndroid Build Coastguard Worker There are two different versions of the DEFINE_GUID macro in guiddef.h (MyGuidDef.h):
12*f6dc9357SAndroid Build Coastguard Worker   - if INITGUID is not defined:  DEFINE_GUID declares an external reference to the symbol name.
13*f6dc9357SAndroid Build Coastguard Worker   - if INITGUID is     defined:  DEFINE_GUID initializes the symbol name to the value of the GUID.
14*f6dc9357SAndroid Build Coastguard Worker 
15*f6dc9357SAndroid Build Coastguard Worker Also we need IID_IUnknown that is initialized in some file for linking:
16*f6dc9357SAndroid Build Coastguard Worker   MSVC:  by default the linker uses some lib file that contains IID_IUnknown
17*f6dc9357SAndroid Build Coastguard Worker   MinGW: add -luuid switch for linker
18*f6dc9357SAndroid Build Coastguard Worker   WinCE: we define IID_IUnknown in this file
19*f6dc9357SAndroid Build Coastguard Worker   Other: we define IID_IUnknown in this file
20*f6dc9357SAndroid Build Coastguard Worker */
21*f6dc9357SAndroid Build Coastguard Worker 
22*f6dc9357SAndroid Build Coastguard Worker // #include "Common.h"
23*f6dc9357SAndroid Build Coastguard Worker /* vc6 without sdk needs <objbase.h> before <initguid.h>,
24*f6dc9357SAndroid Build Coastguard Worker    but it doesn't work in new msvc.
25*f6dc9357SAndroid Build Coastguard Worker    So we include full "MyWindows.h" instead of <objbase.h> */
26*f6dc9357SAndroid Build Coastguard Worker // #include <objbase.h>
27*f6dc9357SAndroid Build Coastguard Worker #include "MyWindows.h"
28*f6dc9357SAndroid Build Coastguard Worker 
29*f6dc9357SAndroid Build Coastguard Worker #ifdef _WIN32
30*f6dc9357SAndroid Build Coastguard Worker 
31*f6dc9357SAndroid Build Coastguard Worker #ifdef __clang__
32*f6dc9357SAndroid Build Coastguard Worker   // #pragma GCC diagnostic ignored "-Wmissing-variable-declarations"
33*f6dc9357SAndroid Build Coastguard Worker #endif
34*f6dc9357SAndroid Build Coastguard Worker 
35*f6dc9357SAndroid Build Coastguard Worker #ifdef UNDER_CE
36*f6dc9357SAndroid Build Coastguard Worker #include <basetyps.h>
37*f6dc9357SAndroid Build Coastguard Worker #endif
38*f6dc9357SAndroid Build Coastguard Worker 
39*f6dc9357SAndroid Build Coastguard Worker // for vc6 without sdk we must define INITGUID here
40*f6dc9357SAndroid Build Coastguard Worker #define INITGUID
41*f6dc9357SAndroid Build Coastguard Worker #include <initguid.h>
42*f6dc9357SAndroid Build Coastguard Worker 
43*f6dc9357SAndroid Build Coastguard Worker #ifdef UNDER_CE
44*f6dc9357SAndroid Build Coastguard Worker DEFINE_GUID(IID_IUnknown,
45*f6dc9357SAndroid Build Coastguard Worker 0x00000000, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46);
46*f6dc9357SAndroid Build Coastguard Worker #endif
47*f6dc9357SAndroid Build Coastguard Worker 
48*f6dc9357SAndroid Build Coastguard Worker #else // _WIN32
49*f6dc9357SAndroid Build Coastguard Worker 
50*f6dc9357SAndroid Build Coastguard Worker #define INITGUID
51*f6dc9357SAndroid Build Coastguard Worker #include "MyGuidDef.h"
52*f6dc9357SAndroid Build Coastguard Worker DEFINE_GUID(IID_IUnknown,
53*f6dc9357SAndroid Build Coastguard Worker 0x00000000, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46);
54*f6dc9357SAndroid Build Coastguard Worker 
55*f6dc9357SAndroid Build Coastguard Worker #endif // _WIN32
56*f6dc9357SAndroid Build Coastguard Worker 
57*f6dc9357SAndroid Build Coastguard Worker #endif
58