Go to the documentation of this file.
13#ifndef ML_UTILS_LIBRARY_INIT_MACROS_H
14#define ML_UTILS_LIBRARY_INIT_MACROS_H
29#pragma warning(disable : 4786 )
33#if !defined(AFX_STDAFX_H__17533C48_9DB6_4FA8_AEC3_550E71AF7183__INCLUDED_)
34#define AFX_STDAFX_H__17533C48_9DB6_4FA8_AEC3_550E71AF7183__INCLUDED_
40#ifndef WIN32_LEAN_AND_MEAN
41#define WIN32_LEAN_AND_MEAN
44#ifndef ML_SUPPRESS_LIBRARY_INIT_MACROS_WINDOWS_H_INCLUDE
45 #include <ThirdPartyWarningsDisable.h>
47 #include <ThirdPartyWarningsRestore.h>
83#define ML_UTILS_INIT_LIBRARY_EXT_3(initMethod, NAMESP, LIB_TARGET) \
85 extern int MLIsCPPAPILinkCompatible(int majorVersion, \
86 int majorCAPIVersion, \
89 BOOL APIENTRY DllMain( HANDLE , \
90 DWORD ul_reason_for_call, \
95 switch (ul_reason_for_call){ \
96 case DLL_PROCESS_ATTACH: \
98 ML_UTILS_NAMESPACE::Runtime::setRecentlyLoadedDllName(#LIB_TARGET); \
102 MLCheckCPPAPILinkCompatibility(ML_MAJOR_VERSION, \
103 ML_MAJOR_CAPI_VERSION, \
113 NAMESP::initMethod(); \
116 case DLL_THREAD_ATTACH: \
119 case DLL_THREAD_DETACH: \
122 case DLL_PROCESS_DETACH: \
134#define ML_UTILS_INIT_LIBRARY_EXT_3(initMethod, NAMESP, LIB_TARGET) \
136 extern int MLInitializeUtils(); \
137 extern int MLIsCPPAPILinkCompatible(int majorVersion, \
138 int majorCAPIVersion, \
141 void initMethod##initDll() __attribute__ ((constructor)); \
142 void initMethod##initDll() \
145 static bool initDone = false; \
152 MLInitializeUtils(); \
155 ML_UTILS_NAMESPACE::Runtime::setRecentlyLoadedDllName(#LIB_TARGET); \
159 MLCheckCPPAPILinkCompatibility(ML_MAJOR_VERSION, \
160 ML_MAJOR_CAPI_VERSION, \
170 NAMESP::initMethod(); \
185#define ML_UTILS_INIT_LIBRARY(initMethod) \
186 _ML_UTILS_INIT_LIBRARY_EXT_HELPER(initMethod, ML_UTILS_NAMESPACE, MEVIS_TARGET)
194#define ML_UTILS_INIT_LIBRARY_EXT(initMethod, NAME_SP) \
195 _ML_UTILS_INIT_LIBRARY_EXT_HELPER(initMethod, NAME_SP, MEVIS_TARGET)
205#define _ML_UTILS_INIT_LIBRARY_EXT_HELPER(initMethod, NAME_SP, LIB_TARGET) \
206 ML_UTILS_INIT_LIBRARY_EXT_2(initMethod, NAME_SP, LIB_TARGET)
212#ifndef ML_STATIC_BUILD
213#define ML_UTILS_INIT_LIBRARY_EXT_2(initMethod, NAME_SP, LIB_TARGET) \
214 ML_UTILS_INIT_LIBRARY_EXT_3(initMethod, NAME_SP, LIB_TARGET)
216#define ML_UTILS_INIT_LIBRARY_EXT_2(initMethod, NAME_SP, LIB_TARGET)