1
/***************************************************************************
2
* Copyright (C) 1995-2002 MySQL AB, www.mysql.com *
4
* This program is free software; you can redistribute it and/or modify *
5
* it under the terms of the GNU General Public License as published by *
6
* the Free Software Foundation; either version 2 of the License, or *
7
* (at your option) any later version. *
9
* This program is distributed in the hope that it will be useful, *
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12
* GNU General Public License for more details. *
14
* You should have received a copy of the GNU General Public License *
15
* along with this program; if not, write to the Free Software Foundation *
16
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
17
****************************************************************************/
19
/***************************************************************************
22
* @description: For LIBMAIN processing *
24
* @author : MySQL AB(monty@mysql.com, venu@mysql.com) *
25
* @date : 2001-Aug-15 *
26
* @product : myodbc3 *
28
****************************************************************************/
33
char *default_locale, *decimal_point, *thousands_sep;
34
uint decimal_point_length,thousands_sep_length;
35
static my_bool myodbc_inited=0;
38
@type : myodbc3 internal
39
@purpose : initializations
42
void myodbc_init(void)
50
DBUG_ENTER("myodbc_init");
53
DBUG_PUSH("d:t:S:O,/tmp/myodbc.log");
55
DBUG_PUSH("d:t:S:O,c::\\myodbc.log");
58
if (getenv("MYODBC_LOG") != NULL)
59
DBUG_PUSH(getenv("MYODBC_LOG"));
62
default_locale=my_strdup(setlocale(LC_NUMERIC,NullS),MYF(0));
63
setlocale(LC_NUMERIC,"");
65
decimal_point=my_strdup(tmp->decimal_point,MYF(0));
66
decimal_point_length=strlen(decimal_point);
67
thousands_sep=my_strdup(tmp->thousands_sep,MYF(0));
68
thousands_sep_length=strlen(thousands_sep);
69
setlocale(LC_NUMERIC,default_locale);
75
@type : myodbc3 internal
76
@purpose : clean all resources while unloading..
84
my_free(decimal_point,MYF(0));
85
my_free(default_locale,MYF(0));
86
my_free(thousands_sep,MYF(0));
95
@type : myodbc3 internal
96
@purpose : main entry point
100
static int inited=0,threads=0;
101
HINSTANCE NEAR s_hModule; /* Saved module handle */
102
int APIENTRY LibMain(HANDLE hInst,DWORD ul_reason_being_called,
105
switch (ul_reason_being_called) {
106
case DLL_PROCESS_ATTACH: /* case of libentry call in win 3.x */
113
case DLL_THREAD_ATTACH:
119
case DLL_PROCESS_DETACH: /* case of wep call in win 3.x */
123
case DLL_THREAD_DETACH:
125
if (threads && --threads)
126
my_thread_end(); /* Last will be freed in my_end() */
137
UNREFERENCED_PARAMETER(lpReserved);
141
@type : myodbc3 internal
142
@purpose : entry point for the DLL
145
int __stdcall DllMain(HANDLE hInst,DWORD ul_reason_being_called,
148
return LibMain(hInst,ul_reason_being_called,lpReserved);
151
#elif defined(__WIN__)
153
/***************************************************************************
154
This routine is called by LIBSTART.ASM at module load time. All it
155
does in this sample is remember the DLL module handle. The module
156
handle is needed if you want to do things like load stuff from the
157
resource file (for instance string resources).
158
***************************************************************************/
160
int _export FAR PASCAL libmain(HANDLE hModule,short cbHeapSize,
161
SQLCHAR FAR *lszCmdLine)
171
void __declspec( dllexport) FAR PASCAL LoadByOrdinal(void);
172
/* Entry point to cause DM to load using ordinals */
173
void __declspec( dllexport) FAR PASCAL LoadByOrdinal(void)