jextract-25 early-access build (25-jextract+2-4) on JDK 25.0.5+8 against SQLite 3.45.1: 25 functions and 13 constants generated into 4 committed files (the whole header would be 83 files), a small Db wrapper, the four arena kinds used wrongly on purpose, ADDRESS vs C_POINTER zero-length vs unbounded segments and the SIGSEGV from getString on a NULL pointer, sqlite3_open out-parameter, return codes to exceptions, a sqlite3_exec upcall and the VM exit when it throws, the JDK 25 native-access warning and --illegal-native-access=deny, library loading failures, and a JMH benchmark of FFM vs hand-written JNI vs plain Java (indicative only: shared 2-CPU machine). Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b6Kg9RWSTJzyz6KP9X
25 lines
1.3 KiB
Bash
Executable File
25 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Regenerate the trimmed SQLite bindings with jextract. Run from anywhere.
|
|
# Needs: JEXTRACT (path to the jextract binary), SQLITE_H (default /usr/include/sqlite3.h).
|
|
set -euo pipefail
|
|
HERE="$(cd "$(dirname "$0")/.." && pwd)"
|
|
JEXTRACT="${JEXTRACT:-jextract}"
|
|
SQLITE_H="${SQLITE_H:-/usr/include/sqlite3.h}"
|
|
OUT="$HERE/generated"
|
|
rm -rf "$OUT"; mkdir -p "$OUT"
|
|
args=()
|
|
for f in sqlite3_libversion sqlite3_libversion_number sqlite3_sourceid \
|
|
sqlite3_open sqlite3_open_v2 sqlite3_close sqlite3_exec \
|
|
sqlite3_errmsg sqlite3_errstr sqlite3_extended_errcode sqlite3_free \
|
|
sqlite3_prepare_v2 sqlite3_step sqlite3_reset sqlite3_finalize \
|
|
sqlite3_bind_int sqlite3_bind_text sqlite3_column_count sqlite3_column_name \
|
|
sqlite3_column_int sqlite3_column_text sqlite3_changes sqlite3_last_insert_rowid sqlite3_strlike sqlite3_column_type; do
|
|
args+=(--include-function "$f")
|
|
done
|
|
for c in SQLITE_OK SQLITE_ERROR SQLITE_BUSY SQLITE_CANTOPEN SQLITE_ROW SQLITE_DONE \
|
|
SQLITE_OPEN_READONLY SQLITE_OPEN_READWRITE SQLITE_OPEN_CREATE SQLITE_TRANSIENT SQLITE_STATIC SQLITE_CONSTRAINT SQLITE_NULL; do
|
|
args+=(--include-constant "$c")
|
|
done
|
|
"$JEXTRACT" --output "$OUT" --target-package demo.sqlite --header-class-name sqlite3_h \
|
|
-l sqlite3 "${args[@]}" "$SQLITE_H"
|