]> git.saurik.com Git - wxWidgets.git/blame - src/iodbc/dlproc.c
another (last?) FreeBSD thread compilation fix
[wxWidgets.git] / src / iodbc / dlproc.c
CommitLineData
cd5bf2a6
RR
1/*
2 * dlproc.c
3 *
4 * $Id$
5 *
6 * Load driver and resolve driver's function entry point
7 *
8 * The iODBC driver manager.
9 *
10 * Copyright (C) 1995 by Ke Jin <kejin@empress.com>
11 *
12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Library General Public
14 * License as published by the Free Software Foundation; either
15 * version 2 of the License, or (at your option) any later version.
16 *
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Library General Public License for more details.
21 *
22 * You should have received a copy of the GNU Library General Public
23 * License along with this library; if not, write to the Free
24 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 */
26
27#include <config.h>
28
29#include <isql.h>
30#include <isqlext.h>
31
32#include <dlproc.h>
33
34#include <herr.h>
35#include <henv.h>
36#include <hdbc.h>
37
38#include <itrace.h>
39
40#include "henv.ci"
41
42HPROC
43_iodbcdm_getproc (HDBC hdbc, int idx)
1a6944fd 44{
cd5bf2a6
RR
45 DBC_t FAR *pdbc = (DBC_t FAR *) hdbc;
46 ENV_t FAR *penv;
47 HDLL hdll;
48 HPROC FAR *phproc;
49
50 if (idx <= 0 || idx > SQL_EXT_API_LAST)
51 /* first entry naver used */
52 {
53 return SQL_NULL_HPROC;
54 }
55
56 penv = (ENV_t FAR *) (pdbc->henv);
57
58 if (penv == NULL)
59 {
60 return SQL_NULL_HPROC;
61 }
62
63 phproc = penv->dllproc_tab + idx;
64
65 if (*phproc == SQL_NULL_HPROC)
66 {
67 int i, en_idx;
68
69 for (i = 0;; i++)
70 {
71 en_idx = odbcapi_symtab[i].en_idx;
72
73 if (en_idx == en_NullProc)
74 {
75 break;
76 }
77
78 if (en_idx == idx)
79 {
80 *phproc = _iodbcdm_dllproc (penv->hdll,
81 odbcapi_symtab[i].symbol);
82
83 break;
84 }
85 }
86 }
87
88 return *phproc;
1a6944fd
RR
89}
90
cd5bf2a6
RR
91
92HDLL
93_iodbcdm_dllopen (char FAR * path)
1a6944fd 94{
cd5bf2a6 95 return (HDLL) DLL_OPEN (path);
1a6944fd
RR
96}
97
cd5bf2a6
RR
98
99HPROC
100_iodbcdm_dllproc (HDLL hdll, char FAR * sym)
1a6944fd 101{
cd5bf2a6 102 return (HPROC) DLL_PROC (hdll, sym);
1a6944fd
RR
103}
104
cd5bf2a6
RR
105
106int
107_iodbcdm_dllclose (HDLL hdll)
1a6944fd 108{
cd5bf2a6 109 DLL_CLOSE (hdll);
1a6944fd 110
cd5bf2a6 111 return 0;
1a6944fd
RR
112}
113
cd5bf2a6
RR
114
115char *
116_iodbcdm_dllerror ()
1a6944fd 117{
cd5bf2a6 118 return DLL_ERROR ();
1a6944fd 119}
cd5bf2a6 120