int WINAPI DllMain ( HINSTANCE hModule, DWORD dwReason, PVOID pvNothing ) { switch ( dwReason ) { case DLL_PROCESS_ATTACH: { return TRUE; } case DLL_PROCESS_DETACH: { // Make sure the client is destroyed upon destruction if ( g_pClient ) { delete g_pClient; g_pClient = NULL; } // Dump any memory leaks we might've had and return DumpUnfreed (); return TRUE; } } return FALSE; }
void CGameSA::Terminate ( void ) { // Initiate the destruction delete this; // Dump any memory leaks if DETECT_LEAK is defined #ifdef DETECT_LEAKS DumpUnfreed(); #endif }
int main(int, char **) { Tranquility *browser = new Tranquility(); browser->Run(); delete browser; #ifdef DEBUG DumpUnfreed(); #endif return 0; }