Skip to main content

Module ffi

Module ffi 

Source
Expand description

C ABI for the JSON command bridge — the entire mobile-facing surface.

Three symbols. Ownership rules (also documented in the shipped header):

  • The caller owns the input buffer; the engine never retains it past the call.
  • Every pointer returned by ballistics_bridge_call / ballistics_bridge_call_n is heap-allocated by the engine and must be released exactly once with ballistics_bridge_free. Freeing NULL is a no-op.
  • The calls NEVER return NULL: every failure mode — invalid UTF-8, bad JSON, unknown command, command failure, internal panic — is an in-band {"ok":false,...} envelope.
  • Calls are independent and thread-safe; there is no shared mutable state.

Functions§

ballistics_bridge_call
Process one bridge request (NUL-terminated UTF-8 JSON envelope).
ballistics_bridge_call_n
Length-explicit variant for callers whose buffers are not NUL-terminated.
ballistics_bridge_free
Release a response produced by the bridge calls. NULL is a no-op.