2005-04-17 17:10:37 +04:00
|
|
|
//+---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#include <windows.h>
|
|
|
|
|
2019-11-27 20:29:12 +03:00
|
|
|
extern void (*__init_array_start[]) (void);
|
|
|
|
extern void (*__init_array_end[]) (void);
|
|
|
|
extern void (*__fini_array_start[]) (void);
|
|
|
|
extern void (*__fini_array_end[]) (void);
|
|
|
|
|
2015-03-03 22:51:13 +03:00
|
|
|
BOOL WINAPI DllMain (HINSTANCE hDll, DWORD dwReason, LPVOID lpReserved);
|
2005-04-17 17:10:37 +04:00
|
|
|
|
2015-03-03 22:51:13 +03:00
|
|
|
BOOL WINAPI _dllstart(HINSTANCE hDll, DWORD dwReason, LPVOID lpReserved)
|
2005-04-17 17:10:37 +04:00
|
|
|
{
|
2019-11-27 20:29:12 +03:00
|
|
|
BOOL bRet;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (dwReason == DLL_PROCESS_ATTACH) { /* ignore DLL_THREAD_ATTACH */
|
|
|
|
i = 0;
|
|
|
|
while (&__init_array_start[i] != __init_array_end) {
|
|
|
|
(*__init_array_start[i++])();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (dwReason == DLL_PROCESS_DETACH) { /* ignore DLL_THREAD_DETACH */
|
|
|
|
i = 0;
|
|
|
|
while (&__fini_array_end[i] != __fini_array_start) {
|
|
|
|
(*__fini_array_end[--i])();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
bRet = DllMain (hDll, dwReason, lpReserved);
|
|
|
|
return bRet;
|
2005-04-17 17:10:37 +04:00
|
|
|
}
|
|
|
|
|