Skip to main content

export_runtime

Macro export_runtime 

Source
macro_rules! export_runtime {
    () => { ... };
}
Expand description

Emit #[no_mangle] extern "C" thunks for every runtime symbol that the WeaveFFI generators expect to find in the consuming cdylib.

The macro expands to a fixed set of functions named with the weaveffi_ prefix:

  • weaveffi_free_string
  • weaveffi_free_bytes
  • weaveffi_error_clear
  • weaveffi_cancel_token_create
  • weaveffi_cancel_token_cancel
  • weaveffi_cancel_token_is_cancelled
  • weaveffi_cancel_token_destroy

§Example

// Inside a cdylib's src/lib.rs
use weaveffi_abi as abi;

abi::export_runtime!();

// ... your generated/hand-written #[no_mangle] business functions ...

Invoke this macro at module scope exactly once in your cdylib. Multiple invocations would produce duplicate symbol definitions.