C ABI / FFI
Stable extern "C" entry points for non-Rust runtimes. The Rust crate remains the full API; the shared library exposes a narrow subset.
Status
ABI v1 behind Cargo feature tetration-ffi:
| Symbol | Role |
|---|---|
tet_abi_version | Must match #define TET_ABI_VERSION in header |
tet_open / tet_close | Read-only .tet handle |
tet_last_error / tet_clear_error | Thread-local UTF-8 error text |
tet_summary_json | Catalog summary JSON |
tet_query_json | Query document JSON → QueryResponse JSON |
tet_verify_json | Quick verify report JSON |
tet_string_free | Free buffers from *_json |
Header: include/tetration.h
Build
bash
# Lean shared library (no HDF5 / NetCDF)
cargo build --release --no-default-features --features tetration-ffiArtifacts:
| Platform | Library |
|---|---|
| Linux | target/release/libtetration.so |
| macOS | target/release/libtetration.dylib |
| Windows | target/release/tetration.dll |
C example
bash
cargo build --release --no-default-features --features tetration-ffi
cc -std=c11 -Wall -Wextra -I include examples/ffi_query.c \
-L target/release -ltetration -o target/release/ffi_query
# macOS
DYLD_LIBRARY_PATH=target/release target/release/ffi_query sample.tetDesign principles
- JSON for documents — query in and structured result out match
tet query -x - Opaque handles —
TetHandleowns mmap + path - Lean library — build with
default-features = falsewhen you only need open/query/verify TET_ABI_VERSION— bump on breaking C symbol changes
Out of v1 ABI: convert/import, writer session, GPU device selection, query history.
Python bindings
Official Python bindings (tet-py) use PyO3 over the Rust crate, not the C ABI. Install from PyPI: pip install tet-py. See Python overview.
Release archives
GitHub Releases attach per-platform FFI archives on tag push (v*). See upstream docs/ffi.md.