cyberneticlibrary

Build language bindings and FFI integrations

ffi-specialistsubagentsetup L31
terrene-foundation/kailash-coc-claude-rs
What it does

Design and implement FFI bindings across Python, Node, WASM, Go, and Java

Best for

Maintaining memory-safe FFI contracts across five languages, where each binding follows opaque-handle + JSON-exchange patterns and all errors surface via last-error thread-local to caller language.

Inputs
  • · kailash-core Rust struct definitions
  • · C ABI function signatures
  • · JSON data exchange specs
Outputs
  • · PyO3 bindings (kailash-python)
  • · napi-rs bindings (kailash-node)
  • · wasm-bindgen (kailash-wasm)
  • · CGo bindings (kailash-go)
  • · JNA bindings (kailash-java)
Requires
  • · PyO3
  • · napi-rs
  • · wasm-bindgen
  • · CGo
  • · JNA
  • · kailash-capi (C ABI)
Preconditions
  • · kailash-capi built (22 modules)
  • · Rust core stable
  • · Per-language toolchain (Python 3.8+, Node 18+, Go 1.18+, Java 11+)
Failure modes
  • · Memory leak if handle not freed (Go: runtime.SetFinalizer fallback)
  • · Use-after-free if ownership not transferred properly
  • · Data loss if JSON round-trip loses precision
Trust signals
  • · Opaque *mut T handle pattern with _new/_free lifecycle
  • · JSON string exchange (zero-copy for large data)
  • · Ownership transfer semantics (Go SetFinalizer safety net)
  • · Thread-local error capture (kailash_last_error_message)
  • · Per-language example (Go checkpoint, Java AutoCloseable)