On Sat, Jul 13, 2013 at 11:14:51AM +0200, Du?an Paulovi? scratched on the wall:
> Hello,
> we are currently facing problem with Access violation exception caused by
> function sqlite3_open_v2 trying to load extensions from unloaded DLLs.
> Also it would be fine to be able to load static extensions to separate
> connections:
> something like:
> int sqlite3_load_static_extension(sqlite3 *db, void (*xEntryPoint)(void));
That would be sqlite3_load_extension():
http://sqlite.org/c3ref/load_extension.html
You should be able to pass a NULL in for the filename to have the
system search the current symbol table context (i.e. the plug-in DLL),
rather than try to load another library.
If this is an acceptable solution, I assume it works because each
plugin manages its own connections to whatever SQLite databases
you're using, and that the plugins do not cross-utilize extensions.
In other words, the SQLite extensions used by a plugin are only used
by that specific plugin, and that plugin "A" does not depend on
SQLite extensions in plugin "B". In that respect, having all the
extensions always auto-load is a bit of overkill, since each
extension will have access to the SQLite extensions in every loaded
plugin (and hence the issues with unloading).
If that's the case, another solution is simply to include a copy of
SQLite in each plugin. If each plugin has its own private copy of
SQLite, then a call to sqlite3_auto_extension() will cause the
plugin's extensions to only be installed in *that* plugin's database
connections. It adds a bit of bulk to every plugin, but on any
type of desktop system, it shouldn't be a big deal. You just need to
integrate the SQLite code directly into the plugin, and make sure it
is built in a way that the SQLite APIs are not exported from the
plugin's DLL (otherwise the different plugins will clash).
-j
--
Jay A. Kreibich < J A Y @ K R E I B I.C H >
"Intelligence is like underwear: it is important that you have it,
but showing it to the wrong people has the tendency to make them
feel uncomfortable." -- Angela Johnson
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users