00001
00002
00003
00004
00005 #define DLMAIN
00006 #define MAJOR 1
00007 #define MINOR 3
00008
00009 #include <stdlib.h>
00010 #include "network.h"
00011
00012 EXPORT int do_kill(void*);
00013
00014 #ifdef WIN32
00015 #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
00016 #include <windows.h>
00017 BOOL APIENTRY DllMain( HANDLE hModule,
00018 DWORD ul_reason_for_call,
00019 LPVOID
00020 )
00021 {
00022 switch (ul_reason_for_call)
00023 {
00024 case DLL_PROCESS_ATTACH:
00025 case DLL_THREAD_ATTACH:
00026 break;
00027 case DLL_THREAD_DETACH:
00028 case DLL_PROCESS_DETACH:
00029 do_kill(hModule);
00030 break;
00031 }
00032 return TRUE;
00033 }
00034
00035 #else // !WIN32
00036
00037 CDECL int dllinit() __attribute__((constructor));
00038 CDECL int dllkill() __attribute__((destructor));
00039
00040 CDECL int dllinit()
00041 {
00042 return 0;
00043 }
00044
00045 CDECL int dllkill() {
00046 do_kill(NULL);
00047 }
00048
00049 #endif // !WIN32