3#if defined(_MSC_VER) && defined(_DEBUG) 
    4#define _CRTDBG_MAP_ALLOC 
    9#include <freetds/windows.h> 
   10#include <freetds/macros.h> 
   14HINSTANCE hinstFreeTDS;
 
   16BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved);
 
   19DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved TDS_UNUSED)
 
   21    hinstFreeTDS = hinstDLL;
 
   23    case DLL_PROCESS_ATTACH:
 
   24#if defined(_MSC_VER) && defined(_DEBUG) 
   25        _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
 
   26        _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDOUT);
 
   27        _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE);
 
   28        _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDOUT);
 
   29        _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE);
 
   30        _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDOUT);
 
   31        _CrtSetDbgFlag(_CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_LEAK_CHECK_DF | _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG));
 
   34        if (tds_socket_init() != 0)
 
   37        DisableThreadLibraryCalls(hinstDLL);
 
   40    case DLL_PROCESS_DETACH:
 
   42#if defined(_MSC_VER) && defined(_DEBUG) 
   43        _CrtDumpMemoryLeaks();