diff options
author | Igor Pavlov <87184205+ip7z@users.noreply.github.com> | 2021-12-27 00:00:00 +0000 |
---|---|---|
committer | Igor Pavlov <87184205+ip7z@users.noreply.github.com> | 2022-03-18 15:35:13 +0500 |
commit | f19f813537c7aea1c20749c914e756b54a9c3cf5 (patch) | |
tree | 816ba62ca7c0fa19f2eb46d9e9d6f7dd7c3a744d /CPP/Common/MyInitGuid.h | |
parent | 98e06a519b63b81986abe76d28887f6984a7732b (diff) | |
download | 7zip-21.07.tar.gz 7zip-21.07.tar.bz2 7zip-21.07.zip |
'21.07'21.07
Diffstat (limited to 'CPP/Common/MyInitGuid.h')
-rw-r--r-- | CPP/Common/MyInitGuid.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/CPP/Common/MyInitGuid.h b/CPP/Common/MyInitGuid.h new file mode 100644 index 0000000..04d77e2 --- /dev/null +++ b/CPP/Common/MyInitGuid.h | |||
@@ -0,0 +1,49 @@ | |||
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 | ||