Skip to main content

PluginEntryFn

Type Alias PluginEntryFn 

Source
pub type PluginEntryFn = unsafe extern "C" fn(&mut dyn PluginRegistrar);
Expand description

Re-export nemo-plugin-api for convenience Plugin entry point function type.

§Safety

This type is the signature for native plugin entry points loaded via dlopen/LoadLibrary. The following invariants must hold:

  • ABI compatibility: The plugin must be compiled with the same Rust compiler version and the same nemo-plugin-api crate version as the host. Mismatched versions cause undefined behaviour due to differing type layouts.
  • Single-threaded call: The host calls this function on the main thread. The PluginRegistrar reference is valid only for the duration of the call and must not be stored or sent to other threads.
  • No unwinding: The entry function must not panic. A panic across the FFI boundary is undefined behaviour. Use catch_unwind internally if necessary.
  • Library lifetime: The dynamic library must remain loaded for as long as any symbols (vtables, function pointers) obtained through the registrar are in use.
  • No re-entrancy: The entry function must not call back into the host’s plugin loading machinery.