SQLite Forum

Using sqlite3_load_extension on windows
You could define redefine SQLITE\_EXTENSION\_INIT1 after the first include.

The reason that these work when appended to the sqlite3.c (the amalgamation) is that it (sqlite3.c) has the symbol SQLITE\_CORE defined which indicates that the sqlite3 API is to be called directly rather than via the "global array of indirect pointers" created by the SQLITE\_EXTENSION\_INIT1 macro (and initialized by the SQLITE\_EXTENSION\_INIT2 macro), thus those macro's expand to /* no-op */ and do nothing.

Since you can only declare a global once, you can only execute the SQLITE3\_EXTENSION\_INIT1 macro once per compilation unit.

#include "eval.c"
#define SQLITE_EXTENSION_INIT1 /* no-op */
#include "carray.c"
... etc ...