network/main.cpp

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

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