powerflow/main.cpp

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

GridLAB-DTM Version 1.0
An open-source project initiated by the US Department of Energy