> I downloaded source code of and compiled spellfix.c (it's inside /ext/misc/)
> like this:
> gcc -shared -fPIC -Wall -I/tmp/sqlite-src-3071700/ spellfix.c -o spellfix
> It compiles successfuly but when i load it into sqlite:
> sqlite> .load ./spellfix
> I'm getting this error:
> Error: ./spellfix: undefined symbol: sqlite3_extension_init
> I really have very few knowledge about compiling c programs. Did i do
> some mistake about compiling or something else is happened? What should i do?
The init function name is sqlite3_spellfix_init
Current versions of sqlite3 should look for this name as well as the older
generic name by default. You can specify the entrypoint name on your .load
command (or in the call to sqlite3_load_extension).
You can also simply append the spellfix.c (or any or all of the extensions) to
the amalgamation code then add some code like this after that (all into the one
amalgamation source file):
int core_init(const char* dummy)
{
int nErr = 0;
nErr += sqlite3_auto_extension((void*)sqlite3_ieee_init);
nErr += sqlite3_auto_extension((void*)sqlite3_nextchar_init);
nErr += sqlite3_auto_extension((void*)sqlite3_percentile_init);
nErr += sqlite3_auto_extension((void*)sqlite3_regexp_init);
nErr += sqlite3_auto_extension((void*)sqlite3_rot_init);
#ifndef SQLITE_OMIT_VIRTUALTABLE
nErr += sqlite3_auto_extension((void*)sqlite3_vtshim_init);
nErr += sqlite3_auto_extension((void*)sqlite3_amatch_init);
nErr += sqlite3_auto_extension((void*)sqlite3_closure_init);
nErr += sqlite3_auto_extension((void*)sqlite3_fuzzer_init);
nErr += sqlite3_auto_extension((void*)sqlite3_spellfix_init);
nErr += sqlite3_auto_extension((void*)sqlite3_wholenumber_init);
#endif
return nErr ? SQLITE_ERROR : SQLITE_OK;
}
Then add the following define when you compile the amalgamation to add the
core_init function to the library initialization sequence.
-DSQLITE_EXTRA_INIT=core_init
So for example, you can append all the /ext/misc extensions to the end of the
amalgamation, add the above code at the end after that, set the additional
define when compiling, and your new sqlite3 engine will have all the extensions
compiled in and available in every connection.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users