rlm@1
|
1 // Common/InitializeStaticLib.h
|
rlm@1
|
2 //
|
rlm@1
|
3 // it's necessary to include this from one cpp file in order to use 7zip as a static library,
|
rlm@1
|
4 // otherwise the linker will optimize away some important internals of 7zip.
|
rlm@1
|
5
|
rlm@1
|
6 #ifndef __COMMON_INITIALIZESTATICLIB_H
|
rlm@1
|
7 #define __COMMON_INITIALIZESTATICLIB_H
|
rlm@1
|
8
|
rlm@1
|
9 #define FORCE_REF(dec, var) extern dec var; void* var##ref = (void*)&var;
|
rlm@1
|
10
|
rlm@1
|
11 #include "../7zip/Common/DeclareCodecs.h"
|
rlm@1
|
12 #include "../7zip/Common/DeclareArcs.h"
|
rlm@1
|
13
|
rlm@1
|
14 FORCE_REF(struct CCRCTableInit, g_CRCTableInit)
|
rlm@1
|
15
|
rlm@1
|
16
|
rlm@1
|
17 // these don't seem to be necessary with my compiler,
|
rlm@1
|
18 // but they're here in case a different compiler more aggressively strips out unreferenced code
|
rlm@1
|
19 FORCE_REF(class CBZip2CrcTableInit, g_BZip2CrcTableInit)
|
rlm@1
|
20 namespace NCrypto { struct CAesTabInit; FORCE_REF(CAesTabInit, g_AesTabInit) }
|
rlm@1
|
21 namespace NBitl { struct CInverterTableInitializer; FORCE_REF(CInverterTableInitializer, g_InverterTableInitializer) }
|
rlm@1
|
22 namespace NCompress { namespace NRar3 { class CDistInit; FORCE_REF(CDistInit, g_DistInit) }}
|
rlm@1
|
23 namespace NArchive { namespace NLzh { class CCRCTableInit; FORCE_REF(CCRCTableInit, g_CRCTableInit) }}
|
rlm@1
|
24 namespace NArchive { namespace N7z { class SignatureInitializer; FORCE_REF(SignatureInitializer, g_SignatureInitializer) }}
|
rlm@1
|
25 namespace NArchive{ namespace NRar{ namespace NHeader{ class CMarkerInitializer; FORCE_REF(CMarkerInitializer, g_MarkerInitializer) }}}
|
rlm@1
|
26 namespace NArchive { namespace NZip { namespace NSignature{ class CMarkersInitializer; FORCE_REF(CMarkersInitializer, g_MarkerInitializer) }}}
|
rlm@1
|
27
|
rlm@1
|
28
|
rlm@1
|
29 #endif
|