NCBI C++ ToolKit
initnet.c
Go to the documentation of this file.

Go to the SVN repository for this file.

1 #if defined(_MSC_VER) && defined(_DEBUG)
2 #define _CRTDBG_MAP_ALLOC
3 #include <stdlib.h>
4 #include <crtdbg.h>
5 #endif
6 
7 #include <winsock2.h>
8 #include <windows.h>
9 
11 
12 #ifdef DLL_EXPORT
13 
14 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved);
15 
16 BOOL WINAPI
17 DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
18 {
19  WSADATA wsaData;
20 
21  hinstFreeTDS = hinstDLL;
22  switch (fdwReason) {
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));
32 #endif
33 
34  if (WSAStartup(MAKEWORD(1, 1), &wsaData) != 0)
35  return FALSE;
36 
37  DisableThreadLibraryCalls(hinstDLL);
38  break;
39 
40  case DLL_PROCESS_DETACH:
41 #if defined(_MSC_VER) && defined(_DEBUG)
42  _CrtDumpMemoryLeaks();
43 #endif
44  break;
45  }
46  return TRUE;
47 }
48 
49 #endif
50 
BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
Definition: dll_main.cpp:8
void * LPVOID
Definition: sqlfront.h:38
int BOOL
Definition: sybdb.h:150
HINSTANCE hinstFreeTDS
Definition: initnet.c:10
#define TRUE
bool replacment for C indicating true.
Definition: ncbi_std.h:97
#define FALSE
bool replacment for C indicating false.
Definition: ncbi_std.h:101
unsigned int DWORD
Definition: sqltypes.h:98
void * HINSTANCE
Definition: sqltypes.h:116
Modified on Wed Jul 17 13:20:15 2024 by modify_doxy.py rev. 669887