Skip to main content

export_plugin

Macro export_plugin 

Source
macro_rules! export_plugin {
    ($logic:ty, $params:ty) => { ... };
}
Expand description

Export the #[unsafe(no_mangle)] symbols the hot-reload shell binds.

The dylib no longer hands the shell a Box<dyn PluginLogicCore> trait object. Instead it exports a flat set of Rust-ABI functions that operate on an opaque state pointer (*mut (), an erased Box<State>): the shell owns the state, so on a hot-reload it can serialize the state through the origin dylib and restore it into freshly-init’d state under the new code (gated by the truce_preserve_dsp_state export).

params_ptr is a raw Arc<Params> pointer from the shell; each call borrows &Params from it (no refcount change - the shell keeps the Arc alive for the call’s duration). Sample is the prelude’s type Sample alias (f32 for prelude / prelude32 / prelude64m, f64 for prelude64); the canary’s sample_precision byte guards a precision-mismatched load.