]> git.saurik.com Git - wxWidgets.git/blob - src/iodbc/dlproc.c
DP: Robert's mistake with incorrect var name corrected.
[wxWidgets.git] / src / iodbc / dlproc.c
1 /** Load driver and resolve driver's function entry point
2
3 Copyright (C) 1995 by Ke Jin <kejin@empress.com>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14 **/
15
16 #include <../iodbc/iodbc.h>
17
18 #include <../iodbc/isql.h>
19 #include <../iodbc/isqlext.h>
20
21 #include <../iodbc/dlproc.h>
22
23 #include <../iodbc/herr.h>
24 #include <../iodbc/henv.h>
25 #include <../iodbc/hdbc.h>
26
27 #include <../iodbc/itrace.h>
28
29 #include "../iodbc/henv.ci"
30
31 HPROC _iodbcdm_getproc( HDBC hdbc, int idx )
32 {
33 DBC_t FAR* pdbc = (DBC_t FAR*)hdbc;
34 ENV_t FAR* penv;
35 /* HDLL hdll; */
36 HPROC FAR* phproc;
37
38 if( idx <= 0 || idx > SQL_EXT_API_LAST )
39 /* first entry naver used */
40 {
41 return SQL_NULL_HPROC;
42 }
43
44 penv = (ENV_t FAR*)(pdbc->henv);
45
46 if( penv == NULL )
47 {
48 return SQL_NULL_HPROC;
49 }
50
51 phproc = penv->dllproc_tab + idx;
52
53 if( *phproc == SQL_NULL_HPROC )
54 {
55 int i, en_idx;
56
57 for( i=0 ; ; i++ )
58 {
59 en_idx = odbcapi_symtab[i].en_idx;
60
61 if( en_idx == en_NullProc )
62 {
63 break;
64 }
65
66 if( en_idx == idx )
67 {
68 *phproc = _iodbcdm_dllproc( penv->hdll,
69 odbcapi_symtab[i].symbol );
70
71 break;
72 }
73 }
74 }
75
76 return *phproc;
77 }
78
79 HDLL _iodbcdm_dllopen( char FAR* path )
80 {
81 return (HDLL)DLL_OPEN( path );
82 }
83
84 HPROC _iodbcdm_dllproc( HDLL hdll, char FAR* sym )
85 {
86 return (HPROC)DLL_PROC( hdll, sym );
87 }
88
89 int _iodbcdm_dllclose( HDLL hdll )
90 {
91 DLL_CLOSE( hdll );
92
93 return 0;
94 }
95
96 char* _iodbcdm_dllerror( )
97 {
98 return DLL_ERROR();
99 }