Add initial support for building with extensions

This commit is contained in:
2026-05-19 00:26:53 +09:00
parent 72b6cf722a
commit 9cd0e995bd
8 changed files with 281 additions and 29 deletions
+38
View File
@@ -0,0 +1,38 @@
#include <sqlite3ext.h>
SQLITE_EXTENSION_INIT1
static void sub_func(
sqlite3_context *ctx,
int argc,
sqlite3_value **argv
) {
if (argc != 2) {
sqlite3_result_null(ctx);
return;
}
int a = sqlite3_value_int(argv[0]);
int b = sqlite3_value_int(argv[1]);
sqlite3_result_int(ctx, a - b);
}
int sqlite3_subext_init(
sqlite3 *db,
char **pzErrMsg,
const sqlite3_api_routines *pApi
) {
SQLITE_EXTENSION_INIT2(pApi);
return sqlite3_create_function(
db,
"sub",
2,
SQLITE_UTF8 | SQLITE_DETERMINISTIC,
0,
sub_func,
0,
0
);
}