This operation could eventually fail for several different reasons: here are the most frequents:
- You are using some odd version of SQLite3/libsqlite3 forbidding to load any dynamic extensions.
This feature could eventually be disabled at build time; if this is your case you simple have to switch to some different SQLite toolkit supporting dynamic extension or build one by yourself.
- The operating system could be unable to correctly locate the dynamic library to be loaded.
The most recent versions of SQLite are smart enough to automatically handle any platform specific suffix: so you are no longer required to specify any .dll or .so suffix. If you wish to do so, you can eventually specify the full path leading to the dynamic library, this including any suffix.
Anyway the default behaviour of load_extension() is the one to search the required dynamic library following the standard platform specific rules.
- The dynamic library itself could be correctly located, but some further depending library could not, thus forbidding to load the main library.
Please note: VirtualPG depends on the PostgreSQL own client library (libpq).
- In any case, if you are using some interactive tool such as sqlite3, spatialite or spatialite_gui some useful and meaningful error message will surely be displayed explaining the failure cause.
This could not be supported while attempting to load an extension from some language binding (e.g. .NET, Python or Java).
In this case attempting to identify the real error cause could be really painful due to poor and sloppy diagnostic support.
- There are no universal rules dictating where to place your extension modules; a good suggestion is to always place all them in the most appropriate system directory.
Important notice: the very recent SQLite 3.7.17 introduced many interesting advanced features to load_extension();
earlier versions of SQLite could probably be someway limited.
If this is your case, please consider that:
- specifying any .dll, .so or .dylib suffix could be strictly required.
- as it could be required to explicitly specify the extension entry point.
- accordingly to all this, you'll probably be required to pass arguments like to following ones to load_extension() while using some obsolete SQLite3 version.
SELECT load_extension('/usr/local/lib/mod_virtualpg.so', 'sqlite3_virtualpg_init');
------
NULL
|