The most cleanly and effective way to approach this is make a large struct called dbtype_api which includes all the functions. Each will provide a plugin_api struct which will return the values needed. Something like this.

struct db_api {
   int (*db_open)(char *);
   void (*db_close)(void);
   ...
};

struct db_api plugin_functions = {
   db_open, /* Provided function from dbmysql.c */
   db_close
   ...
};

Where ever the hell this thing is loaded

lt_dlinit();
lt_dlhandle handle = lt_dlopen((value spit out from GetConfigValue));
struct db_api *foo;
foo = lt_dlsym(handle, "plugin_functions");

so, 'foo' is your ticket to all the functions in the module
then since itd be a pretty hefty job to do all that rename to foo->db_open. We could just provide generic functions that just call foo->db_*.

Dan Weber

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to