@@ -135,6 +135,39 @@ const char *dbtypestrings[] = {
135135
136136};
137137
138+ static void *DBcallback_loadmodule (const char *p_path)
139+ {
140+ int t_success;
141+ void *t_handle;
142+ LoadModule (p_path, &t_handle, &t_success);
143+ if (t_success == EXTERNAL_FAILURE )
144+ return NULL ;
145+ return t_handle;
146+ }
147+
148+ static void DBcallback_unloadmodule (void *p_handle)
149+ {
150+ int t_success;
151+ UnloadModule (p_handle, &t_success);
152+ }
153+
154+ static void *DBcallback_resolvesymbol (void *p_handle, const char *p_symbol)
155+ {
156+ int t_success;
157+ void *t_address;
158+ ResolveSymbolInModule (p_handle, p_symbol, &t_address, &t_success);
159+ if (t_success == EXTERNAL_FAILURE )
160+ return NULL ;
161+ return t_address;
162+ }
163+
164+ static DBcallbacks dbcallbacks = {
165+ DBcallbacks_version,
166+ DBcallback_loadmodule,
167+ DBcallback_unloadmodule,
168+ DBcallback_resolvesymbol,
169+ };
170+
138171DATABASERECList databaselist;
139172DBList connectionlist;
140173
@@ -252,17 +285,21 @@ DATABASEREC *LoadDatabaseDriverFromName(const char *p_type)
252285#endif
253286
254287 void *id_counterref_ptr, *new_connectionref_ptr, *release_connectionref_ptr;
288+ void *set_callbacksref_ptr;
255289 id_counterref_ptr = NULL ;
256290 new_connectionref_ptr = NULL ;
257291 release_connectionref_ptr = NULL ;
292+ set_callbacksref_ptr = NULL ;
258293
259294 ResolveSymbolInModule (t_handle, " setidcounterref" , &id_counterref_ptr, &t_retvalue);
260295 ResolveSymbolInModule (t_handle, " newdbconnectionref" , &new_connectionref_ptr, &t_retvalue);
261296 ResolveSymbolInModule (t_handle, " releasedbconnectionref" , &release_connectionref_ptr, &t_retvalue);
297+ ResolveSymbolInModule (t_handle, " setcallbacksref" , &set_callbacksref_ptr, &t_retvalue);
262298
263299 t_result -> idcounterptr = (idcounterrefptr)id_counterref_ptr;
264300 t_result -> newconnectionptr = (new_connectionrefptr)new_connectionref_ptr;
265301 t_result -> releaseconnectionptr = (release_connectionrefptr)release_connectionref_ptr;
302+ t_result -> setcallbacksptr = (set_callbacksrefptr)set_callbacksref_ptr;
266303 return t_result;
267304}
268305
@@ -368,6 +405,8 @@ DATABASEREC *LoadDatabaseDriver(const char *p_type)
368405 strcpy (t_database_rec -> dbname, p_type);
369406 if (t_database_rec -> idcounterptr)
370407 (*t_database_rec -> idcounterptr)(&idcounter);
408+ if (t_database_rec -> setcallbacksptr)
409+ (*t_database_rec -> setcallbacksptr)(&dbcallbacks);
371410 }
372411
373412 return t_database_rec;
0 commit comments