aimux-ffi: C ABI boundary for multi-language bindings.
Provides an opaque handle registry + JSON wire boundary + push callback
stream. Only used by C ABI bindings (Swift / Kotlin / C). Native bindings
(Python / Node / Flutter) bypass this layer and use aimux-providers
directly.
Memory ownership
- [
aimux_generate_text] returns a*mut c_charowned by the caller; the caller MUST free it with [aimux_free_string]. - [
aimux_stream_text] callbacks receive*const c_charpointers that are valid only for the duration of the callback. The callback must copy the data synchronously; the backing buffer is freed when the callback returns.
Concurrency
All async provider work runs on a shared multi-threaded tokio runtime. The
C ABI functions are synchronous: they block_on the runtime until the
operation completes. Callbacks execute on the same thread/call-stack that
invoked the FFI function, so they must not re-enter the FFI layer (doing so
would deadlock the runtime).