Index: ext/fts1/fts1.c ================================================================== --- ext/fts1/fts1.c +++ ext/fts1/fts1.c @@ -3333,12 +3333,15 @@ sqlite3_overload_function(db, "offsets", -1); return sqlite3_create_module(db, "fts1", &fulltextModule, 0); } #if !SQLITE_CORE -int sqlite3_extension_init(sqlite3 *db, char **pzErrMsg, - const sqlite3_api_routines *pApi){ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int sqlite3_fts1_init(sqlite3 *db, char **pzErrMsg, + const sqlite3_api_routines *pApi){ SQLITE_EXTENSION_INIT2(pApi) return sqlite3Fts1Init(db); } #endif Index: ext/fts1/fulltext.c ================================================================== --- ext/fts1/fulltext.c +++ ext/fts1/fulltext.c @@ -850,12 +850,18 @@ ** argv[1] - database name ** argv[2] - table name ** argv[3] - tokenizer name (optional, a sensible default is provided) ** argv[4..] - passed to tokenizer (optional based on tokenizer) **/ -static int fulltextConnect(sqlite3 *db, void *pAux, int argc, char **argv, - sqlite3_vtab **ppVTab){ +static int fulltextConnect( + sqlite3 *db, + void *pAux, + int argc, + const char * const *argv, + sqlite3_vtab **ppVTab, + char **pzErr +){ int rc; fulltext_vtab *v; sqlite3_tokenizer_module *m = NULL; assert( argc>=3 ); @@ -896,12 +902,18 @@ *ppVTab = &v->base; return SQLITE_OK; } -static int fulltextCreate(sqlite3 *db, void *pAux, int argc, char **argv, - sqlite3_vtab **ppVTab){ +static int fulltextCreate( + sqlite3 *db, + void *pAux, + int argc, + const char * const *argv, + sqlite3_vtab **ppVTab, + char **pzErr +){ int rc; assert( argc>=3 ); /* The %_content table holds the text of each full-text item, with ** the rowid used as the docid. @@ -932,11 +944,11 @@ "create table %_content(content text);" "create table %_term(term text, first integer, doclist blob);" "create index %_index on %_term(term, first)"); if( rc!=SQLITE_OK ) return rc; - return fulltextConnect(db, pAux, argc, argv, ppVTab); + return fulltextConnect(db, pAux, argc, argv, ppVTab, pzErr); } /* Decide how to handle an SQL query. * At the moment, MATCH queries can include implicit boolean ANDs; we * haven't implemented phrase searches or OR yet. */ @@ -1486,11 +1498,14 @@ int fulltext_init(sqlite3 *db){ return sqlite3_create_module(db, "fulltext", &fulltextModule, 0); } #if !SQLITE_CORE -int sqlite3_extension_init(sqlite3 *db, char **pzErrMsg, - const sqlite3_api_routines *pApi){ +#ifdef _WIN32 +__declspec(dllexport) +#endif +int sqlite3_fulltext_init(sqlite3 *db, char **pzErrMsg, + const sqlite3_api_routines *pApi){ SQLITE_EXTENSION_INIT2(pApi) return fulltext_init(db); } #endif Index: ext/fts2/fts2.c ================================================================== --- ext/fts2/fts2.c +++ ext/fts2/fts2.c @@ -6842,11 +6842,14 @@ } return rc; } #if !SQLITE_CORE -int sqlite3_extension_init( +#ifdef _WIN32 +__declspec(dllexport) +#endif +int sqlite3_fts2_init( sqlite3 *db, char **pzErrMsg, const sqlite3_api_routines *pApi ){ SQLITE_EXTENSION_INIT2(pApi) Index: ext/fts2/fts2_hash.c ================================================================== --- ext/fts2/fts2_hash.c +++ ext/fts2/fts2_hash.c @@ -28,10 +28,12 @@ #include #include #include #include "sqlite3.h" +#include "sqlite3ext.h" +SQLITE_EXTENSION_INIT3 #include "fts2_hash.h" /* ** Malloc and Free functions */ Index: ext/fts2/fts2_porter.c ================================================================== --- ext/fts2/fts2_porter.c +++ ext/fts2/fts2_porter.c @@ -28,10 +28,13 @@ #include #include #include #include +#include "sqlite3.h" +#include "sqlite3ext.h" +SQLITE_EXTENSION_INIT3 #include "fts2_tokenizer.h" /* ** Class derived from sqlite3_tokenizer */ Index: ext/fts2/fts2_tokenizer.c ================================================================== --- ext/fts2/fts2_tokenizer.c +++ ext/fts2/fts2_tokenizer.c @@ -26,11 +26,11 @@ #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS2) #include "sqlite3.h" #include "sqlite3ext.h" -SQLITE_EXTENSION_INIT1 +SQLITE_EXTENSION_INIT3 #include "fts2_hash.h" #include "fts2_tokenizer.h" #include Index: ext/fts2/fts2_tokenizer1.c ================================================================== --- ext/fts2/fts2_tokenizer1.c +++ ext/fts2/fts2_tokenizer1.c @@ -28,10 +28,13 @@ #include #include #include #include +#include "sqlite3.h" +#include "sqlite3ext.h" +SQLITE_EXTENSION_INIT3 #include "fts2_tokenizer.h" typedef struct simple_tokenizer { sqlite3_tokenizer base; char delim[128]; /* flag ASCII delimiters */ Index: ext/fts3/fts3.c ================================================================== --- ext/fts3/fts3.c +++ ext/fts3/fts3.c @@ -5374,11 +5374,14 @@ #if !SQLITE_CORE /* ** Initialize API pointer table, if required. */ -int sqlite3_extension_init( +#ifdef _WIN32 +__declspec(dllexport) +#endif +int sqlite3_fts3_init( sqlite3 *db, char **pzErrMsg, const sqlite3_api_routines *pApi ){ SQLITE_EXTENSION_INIT2(pApi) Index: ext/fts3/fts3Int.h ================================================================== --- ext/fts3/fts3Int.h +++ ext/fts3/fts3Int.h @@ -30,11 +30,11 @@ #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) /* If not building as part of the core, include sqlite3ext.h. */ #ifndef SQLITE_CORE # include "sqlite3ext.h" -extern const sqlite3_api_routines *sqlite3_api; +SQLITE_EXTENSION_INIT3 #endif #include "sqlite3.h" #include "fts3_tokenizer.h" #include "fts3_hash.h" Index: ext/icu/icu.c ================================================================== --- ext/icu/icu.c +++ ext/icu/icu.c @@ -486,11 +486,14 @@ return rc; } #if !SQLITE_CORE -int sqlite3_extension_init( +#ifdef _WIN32 +__declspec(dllexport) +#endif +int sqlite3_icu_init( sqlite3 *db, char **pzErrMsg, const sqlite3_api_routines *pApi ){ SQLITE_EXTENSION_INIT2(pApi) Index: ext/rtree/rtree.c ================================================================== --- ext/rtree/rtree.c +++ ext/rtree/rtree.c @@ -3348,11 +3348,14 @@ (void *)pGeomCtx, geomCallback, 0, 0, doSqlite3Free ); } #if !SQLITE_CORE -int sqlite3_extension_init( +#ifdef _WIN32 +__declspec(dllexport) +#endif +int sqlite3_rtree_init( sqlite3 *db, char **pzErrMsg, const sqlite3_api_routines *pApi ){ SQLITE_EXTENSION_INIT2(pApi) Index: mkextw.sh ================================================================== --- mkextw.sh +++ mkextw.sh @@ -9,11 +9,11 @@ NM="i386-mingw32msvc-nm" CMD="$CC -c fts2amal.c" echo $CMD $CMD echo 'EXPORTS' >fts2.def -echo 'sqlite3_extension_init' >>fts2.def +echo 'sqlite3_fts2_init' >>fts2.def i386-mingw32msvc-dllwrap \ --def fts2.def -v --export-all \ --driver-name i386-mingw32msvc-gcc \ --dlltool-name i386-mingw32msvc-dlltool \ --as i386-mingw32msvc-as \ Index: src/sqlite3ext.h ================================================================== --- src/sqlite3ext.h +++ src/sqlite3ext.h @@ -472,13 +472,16 @@ #ifndef SQLITE_CORE /* This case when the file really is being compiled as a loadable ** extension */ # define SQLITE_EXTENSION_INIT1 const sqlite3_api_routines *sqlite3_api=0; # define SQLITE_EXTENSION_INIT2(v) sqlite3_api=v; +# define SQLITE_EXTENSION_INIT3 \ + extern const sqlite3_api_routines *sqlite3_api; #else /* This case when the file is being statically linked into the ** application */ # define SQLITE_EXTENSION_INIT1 /*no-op*/ # define SQLITE_EXTENSION_INIT2(v) (void)v; /* unused parameter */ +# define SQLITE_EXTENSION_INIT3 /*no-op*/ #endif #endif /* _SQLITE3EXT_H_ */ Index: src/test_schema.c ================================================================== --- src/test_schema.c +++ src/test_schema.c @@ -342,11 +342,14 @@ #else /* ** Extension load function. */ -int sqlite3_extension_init( +#ifdef _WIN32 +__declspec(dllexport) +#endif +int sqlite3_schema_init( sqlite3 *db, char **pzErrMsg, const sqlite3_api_routines *pApi ){ SQLITE_EXTENSION_INIT2(pApi);