4 * Description: This module contains the main entry point (DllMain)
5 * for the library. It also contains functions to get
6 * and set global variables for the driver in the registry.
12 * Comments: See "notice.txt" for copyright and license information.
17 #include "dlg_specific.h"
23 GLOBAL_VALUES globals;
25 RETCODE SQL_API SQLDummyOrdinal(void);
28 HINSTANCE NEAR s_hModule; /* Saved module handle. */
30 /* This is where the Driver Manager attaches to this Driver */
32 DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
34 WORD wVersionRequested;
37 switch (ul_reason_for_call)
39 case DLL_PROCESS_ATTACH:
40 s_hModule = hInst; /* Save for dialog boxes */
42 /* Load the WinSock Library */
43 wVersionRequested = MAKEWORD(1, 1);
45 if (WSAStartup(wVersionRequested, &wsaData))
48 /* Verify that this is the minimum version of WinSock */
49 if (LOBYTE(wsaData.wVersion) != 1 ||
50 HIBYTE(wsaData.wVersion) != 1)
56 getCommonDefaults(DBMS_NAME, ODBCINST_INI, NULL);
59 case DLL_THREAD_ATTACH:
62 case DLL_PROCESS_DETACH:
66 case DLL_THREAD_DETACH:
75 UNREFERENCED_PARAMETER(lpReserved);
89 /* This function is called at library initialization time. */
92 __attribute__((constructor))
95 getCommonDefaults(DBMS_NAME, ODBCINST_INI, NULL);
99 #else /* not __GNUC__ */
102 * These two functions do shared library initialziation on UNIX, well at least
103 * on Linux. I don't know about other systems.
108 getCommonDefaults(DBMS_NAME, ODBCINST_INI, NULL);
118 #endif /* not __GNUC__ */
120 #endif /* not WIN32 */
124 * This function is used to cause the Driver Manager to
125 * call functions by number rather than name, which is faster.
126 * The ordinal value of this function must be 199 to have the
127 * Driver Manager do this. Also, the ordinal values of the
128 * functions must match the value of fFunction in SQLGetFunctions()
131 SQLDummyOrdinal(void)