3#if defined(_MSC_VER) && defined(_DEBUG)
4#define _CRTDBG_MAP_ALLOC
9#include <freetds/windows.h>
10#include <freetds/macros.h>
11#include <freetds/sysdep_private.h>
15HINSTANCE hinstFreeTDS;
17BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved);
20DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved TDS_UNUSED)
22 hinstFreeTDS = hinstDLL;
24 case DLL_PROCESS_ATTACH:
25#if defined(_MSC_VER) && defined(_DEBUG)
26 _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
27 _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDOUT);
28 _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE);
29 _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDOUT);
30 _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE);
31 _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDOUT);
32 _CrtSetDbgFlag(_CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_LEAK_CHECK_DF | _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG));
35 if (tds_socket_init() != 0)
38 DisableThreadLibraryCalls(hinstDLL);
41 case DLL_PROCESS_DETACH:
43#if defined(_MSC_VER) && defined(_DEBUG)
44 _CrtDumpMemoryLeaks();