Skip to main content

nros_rmw_cffi_register_named

Function nros_rmw_cffi_register_named 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn nros_rmw_cffi_register_named( name: *const c_char, vtable: *const NrosRmwVtable, ) -> NrosRmwRet
Expand description

Register a backend under a stable name. Multiple backends can coexist; consumers select via nros_rmw_cffi_lookup or the higher-level Executor::node_builder(...).rmw(...) path.

Names must be UTF-8, NUL-terminated, ≤ 31 bytes (excluding NUL). Reserved names today: "zenoh", "dds", "xrce", "cyclonedds", future "uorb". The string "default" is the implicit name used by the legacy single-arg nros_rmw_cffi_register shim.

Returns:

  • NROS_RMW_RET_OK on success.
  • NROS_RMW_RET_INVALID_ARGUMENT if name / vtable is NULL, the name is empty, or exceeds 31 bytes.
  • NROS_RMW_RET_ERROR if the registry is full (MAX_BACKENDS reached without a matching entry).

Duplicate registration of the same name overwrites the previous vtable (idempotent for ctor-fires-twice cases).

§Safety

  • name must be a valid NUL-terminated UTF-8 string.
  • vtable must remain valid for the program’s lifetime.