Skip to main content

nros_rmw_register_backend

Macro nros_rmw_register_backend 

Source
macro_rules! nros_rmw_register_backend {
    (fn() $body:block) => { ... };
}
Expand description

Macro emitted by backend crates to self-register their vtable.

On hosted targets (not(target_os = "none")) it expands to a #[used] ctor function pointer landed in the loader’s pre-main init section (.init_array on ELF). The loader invokes the ctor before main; the ctor body is $body, which calls the backend’s register(). On embedded (target_os = "none") it expands to nothing — the board calls register() explicitly.

Usage (inside the backend crate):

nros_rmw_cffi::nros_rmw_register_backend! {
    fn() { let _ = nros_rmw_zenoh_register(); }
}