Go to the documentation of this file.
13#ifndef ML_LIBRARY_INIT_MACROS_H
14#define ML_LIBRARY_INIT_MACROS_H
24#pragma warning(disable : 4786 )
28#if !defined(AFX_STDAFX_H__17533C48_9DB6_4FA8_AEC3_550E71AF7183__INCLUDED_)
29#define AFX_STDAFX_H__17533C48_9DB6_4FA8_AEC3_550E71AF7183__INCLUDED_
33#ifndef WIN32_LEAN_AND_MEAN
34#define WIN32_LEAN_AND_MEAN
37#ifndef ML_SUPPRESS_LIBRARY_INIT_MACROS_WINDOWS_H_INCLUDE
38 #include <ThirdPartyWarningsDisable.h>
40 #include <ThirdPartyWarningsRestore.h>
80#define ML_LIBRARY_USER_DESTROY_CODE
101#define ML_INIT_LIBRARY_EXT_3(initMethod, NAMESP, LIB_TARGET) \
102 BOOL APIENTRY DllMain( HANDLE , \
103 DWORD ul_reason_for_call, \
108 switch (ul_reason_for_call){ \
109 case DLL_PROCESS_ATTACH: \
112 ML_UTILS_NAMESPACE::Runtime::setRecentlyLoadedDllName(#LIB_TARGET); \
116 MLCheckCPPAPILinkCompatibility(ML_MAJOR_VERSION, \
117 ML_MAJOR_CAPI_VERSION, \
127 NAMESP::initMethod(); \
130 case DLL_THREAD_ATTACH: \
132 case DLL_THREAD_DETACH: \
134 case DLL_PROCESS_DETACH: \
140 if (MLIsCurrentlyUnloadingLibrary()){ \
141 ML_LIBRARY_USER_DESTROY_CODE \
142 ML_UTILS_NAMESPACE::Runtime::destroyRuntimeTypesOfDll(#LIB_TARGET); \
155#define ML_INIT_LIBRARY_EXT_3(initMethod, NAMESP, LIB_TARGET) \
157 extern int MLInit(int majorVersion, \
158 int majorCAPIVersion, \
160 extern int MLIsCPPAPILinkCompatible(int majorVersion, \
161 int majorCAPIVersion, \
165 void initMethod##initDll() __attribute__ ((constructor)); \
166 void initMethod##initDll() \
169 static bool initDone = false; \
176 MLInit(ML_MAJOR_VERSION, ML_MAJOR_CAPI_VERSION, ML_CAPI_REVISION); \
179 ML_UTILS_NAMESPACE::Runtime::setRecentlyLoadedDllName(#LIB_TARGET); \
183 MLCheckCPPAPILinkCompatibility(ML_MAJOR_VERSION, \
184 ML_MAJOR_CAPI_VERSION, \
194 NAMESP::initMethod(); \
201 void initMethod##destroyDll() __attribute__ ((destructor)); \
202 void initMethod##destroyDll() \
208 if (MLIsCurrentlyUnloadingLibrary()){ \
209 ML_LIBRARY_USER_DESTROY_CODE \
210 ML_UTILS_NAMESPACE::Runtime::destroyRuntimeTypesOfDll(#LIB_TARGET); \
223#define ML_INIT_LIBRARY(initMethod) \
224 _ML_INIT_LIBRARY_EXT_HELPER(initMethod, ML_UTILS_NAMESPACE, MEVIS_TARGET)
230#define ML_INIT_LIBRARY_EXT(initMethod, NAME_SP) \
231 _ML_INIT_LIBRARY_EXT_HELPER(initMethod, NAME_SP, MEVIS_TARGET)
241#define _ML_INIT_LIBRARY_EXT_HELPER(initMethod, NAME_SP, LIB_TARGET) \
242 ML_INIT_LIBRARY_EXT_2(initMethod, NAME_SP, LIB_TARGET)
248#ifndef ML_STATIC_BUILD
249#define ML_INIT_LIBRARY_EXT_2(initMethod, NAME_SP, LIB_TARGET) \
250 ML_INIT_LIBRARY_EXT_3(initMethod, NAME_SP, LIB_TARGET)
252#define ML_INIT_LIBRARY_EXT_2(initMethod, NAME_SP, LIB_TARGET)