Skip to main content

Module cabi

Module cabi 

Source
Expand description

Loading function libraries that speak the plain C ABI.

The host tries the abi_stable root module first; a library without one is offered here. What comes back is an ordinary BoxedFunction, so everything downstream — routing, visibility, OpenAPI, lifecycle hooks — treats a function written in C exactly like one written in Rust.

Two rules govern everything below, and both exist because the other side of the boundary is not Rust:

  • Nothing may unwind into C. Every callback the host exposes is wrapped in catch_unwind, because a panic crossing an extern "C" frame aborts the process instead of failing one request.
  • Each side frees what it allocated. The library and the host may not share an allocator, so host strings go back through free_string and the library’s output comes back through its own apiplant_free.

Functions§

load
Try to load path as a C-ABI library, returning its functions.