comparison src/win32/7zip/7z/CPP/Common/InitializeStaticLib.h @ 1:f9f4f1b99eed

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