It looks like it is designed to "compile right in".  You just need to append it 
to the amalgamation source file, then you just need to pass an appropriate 
function name in the define SQLITE3_EXTRA_INIT so that whenever a database 
connection is opened the function is called to perform "extra init" functions 
when the engine is initialized, such as add all the init functions to the 
autoinit list ...

So for example, you append all your builtin function code to the end of 
sqlite3.c, append a coreinit function that looks something like this as an 
example):

#ifdef USE_NUNICODE
extern void* sqlite3_nunicode_init(void*);
#endif

int core_init(const char* dummy)
{
    int nErr = 0;

    nErr += sqlite3_auto_extension((void*)sqlite3_sqlfunc_init);
#ifdef USE_NUNICODE
    nErr += sqlite3_auto_extension((void*)sqlite3_nunicode_init);
#else
    nErr += sqlite3_auto_extension((void*)sqlite3_unifuzz_init);
#endif
    nErr += sqlite3_auto_extension((void*)sqlite3_eval_init);
    nErr += sqlite3_auto_extension((void*)sqlite3_fileio_init);
    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);
    nErr += sqlite3_auto_extension((void*)sqlite3_totype_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);
#ifndef _MSC_VER
    nErr += sqlite3_auto_extension((void*)sqlite3_compress_init);
    nErr += sqlite3_auto_extension((void*)sqlite3_interpolate_init);
//    nErr += sqlite3_auto_extension((void*)sqlite3_pcre_init);
#endif
#endif

    return nErr ? SQLITE_ERROR : SQLITE_OK;
}

then compile the amalgamation with -DSQLITE3_EXTRA_INIT=core_init
and all those extensions will be automatically included for every connection, 
just like the built-in ones are.

> -----Original Message-----
> From: sqlite-users-bounces at mailinglists.sqlite.org [mailto:sqlite-users-
> bounces at mailinglists.sqlite.org] On Behalf Of Joe.Fisher at tanguaylab.com
> Sent: Friday, 22 May, 2015 14:19
> To: sqlite-users at mailinglists.sqlite.org
> Subject: [sqlite] RSQLite.extfuns.dll -- Looking for Linux binary
> extension
> 
> Does anyone know if a Linux binary extension of this is available (.so)?
> If you load RSQLite package into R you will get the RSQLite.so file that
> can be used as an extension in a Linux version of SQLite. It works.
> http://cran.r-project.org/web/packages/RSQLite/index.html
> 
> (RSQLite.extfuns.dll) is 40 KB while RSQLite.so is 4 MB. It appears that
> (RSQLite.extfuns.dll) is just the "extension-functions.c", while
> RSQLite.so is a full implementation of SQLite for R plus the extension
> functions.
> 
> (RSQLite.extfuns.dll) still works on Windows versions of software that
> use SQLite.
> I wish these were compiled into every release of SQLite as they are very
> useful.
> 
> Math: acos, asin, atan, atn2, atan2, acosh, asinh, atanh, difference,
> degrees, radians, cos, sin, tan, cot, cosh, sinh, tanh, coth, exp, log,
> log10, power, sign, sqrt, square, ceil, floor, pi.
> String: replicate, charindex, leftstr, rightstr, ltrim, rtrim, trim,
> replace, reverse, proper, padl, padr, padc, strfilter.
> Aggregate: stdev, variance, mode, median, lower_quartile, upper_quartile.
> The string functions ltrim, rtrim, trim, replace are included in recent
> versions of SQLite and so by default do not build.
> 
> https://github.com/seth/RSQLite.extfuns/blob/master/src/extension-
> functions.c
> 
> Joe Fisher
> Oregon State University
> 
> 
> 
> 
> 
> _______________________________________________
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



Reply via email to