-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
The current plugin supports loading extensions as seen in: https://github.com/mattn/go-sqlite3/blob/master/sqlite3_load_extension.go#L28 using:
C.sqlite3_load_extension(c.db, cext, nil, nil)
whereas the method is defined as (https://www.sqlite.org/c3ref/load_extension.html)
int sqlite3_load_extension(
sqlite3 *db, /* Load the extension into this database connection */
const char *zFile, /* Name of the shared library containing extension */
const char *zProc, /* Entry point. Derived from zFile if 0 */
char **pzErrMsg /* Put error message here if not 0 */
);
I would like to have/provide support for overriding the third argument, the entrypoint to the extension.
My problem:
I want to load the spatialite
extension via go-sqlite3
on Android. spatialite
comes in 2 flavours, either as a shared library (libspatialite.so
) or as an sqlite3 extension mod_spatialite.so
. Since mod_spatialite.so
has to be built with Android ndk-build
, and ndk-build
only supports library names of the form libMODULENAME.so
, the resulting spatialite extension filename is called libspatialite.so
, whilst the entrypoint still points to the original modulename, mod_spatialite.so
and thus will be sqlite3_modspatialite_init
.
Sqlite will automatically guess an entrypoint given a filename, if no entrypoint is given:
libspatialite.so
has the (guessed) entrypointsqlite3_spatialite_init
mod_spatialite.so
has the (guessed) entrypointsqlite3_modspatialite_init
What I need:
load_extension('libspatialite.so','sqlite3_modspatialite_init')
I do not know, what would be a good variant how to integrate this in go-sqlite3
. Maybe an Extension
struct.