D 2014-06-25T17:03:02.597 L mod_spatialite U sandro W 5308 back to 4.2.0-doc

Dynamically loading SpatiaLite as an extension module

Theoretical foundations

Speacking in rigorous technical terms, SpatiaLite simply is an extension to SQLite.
Consequently we are strictly required to deploy some appropriate mechanism allowing to load both binary libraries (libsqlite3 and libspatialite) and properly registering within SQLite3 the many extended Spatial SQL functions implemented by SpatiaLite.
A further compication should be taken in proper debt; libspatialite isn't a stand-alone self-contained library, and depends on several further libraries (libgeos, libproj, libxml2 and so on).

There are several possible alternative paths leading to this final goal:

How it works

libsqlite3 has the capability to dynamically load extension modules. This feature is available as a C-language API, but is avaibles as a special SQL function as well: SELECT load_extension('mod_spatialite'); This SQL function make elementary simple (and language independent) the problem of loading any possible extension; you are simply expected to execute a rather trivial SQL statement in order to load an external extension.

Loadable extension anathomy:

back to 4.2.0-doc Z 8b2e823048b8ecede253987fe6050ada