00001
00010
00011
00012
00013
00014
00015
00016 #define DLMAIN
00017
00018
00019 #define MAJOR 1
00020 #define MINOR 3
00021
00022 #include <stdlib.h>
00023 #include "gridlabd.h"
00024
00025 EXPORT int do_kill(void*);
00026
00027 EXPORT int major=MAJOR, minor=MINOR;
00028
00029 #ifdef WIN32
00030 #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
00031 #include <windows.h>
00032
00033 BOOL APIENTRY DllMain( HANDLE hModule,
00034 DWORD ul_reason_for_call,
00035 LPVOID
00036 )
00037 {
00038 switch (ul_reason_for_call)
00039 {
00040 case DLL_PROCESS_ATTACH:
00041 case DLL_THREAD_ATTACH:
00042 break;
00043 case DLL_THREAD_DETACH:
00044 case DLL_PROCESS_DETACH:
00045 do_kill(hModule);
00046 break;
00047 }
00048 return TRUE;
00049 }
00050
00051 #else // !WIN32
00052
00053 CDECL int dllinit() __attribute__((constructor));
00054 CDECL int dllkill() __attribute__((destructor));
00055
00056 CDECL int dllinit()
00057 {
00058 return 0;
00059 }
00060
00061 CDECL int dllkill() {
00062 do_kill(NULL);
00063 }
00064
00065 #endif // !WIN32
00066