Skip to main content

declare_node_app

Macro declare_node_app 

Source
macro_rules! declare_node_app {
    ($app_type:ty) => { ... };
}
Expand description

Generate all FFI boilerplate for a NodeApp implementation.

This macro creates:

  • A OnceLock<Mutex<T>> instance for the app (sound concurrent access).
  • The _node_app_entry export symbol returning a NodeAppVTable.
  • FFI wrapper functions for init, shutdown, handle_request, handle_event, handle_capability, and free.
  • catch_unwind guards on every FFI boundary to prevent UB from panics crossing the Rust/C ABI.
  • Thread-local trace span management around handle_capability.

Invoke once at the crate root after defining the app type:

declare_node_app!(MyApp);