Skip to main content

Module wrapper

Module wrapper 

Source
Expand description

catch_unwind helpers for FFI boundaries between rack and plugin code.

Plugin libraries are written by third parties. A panic in a plugin’s process (or any other callback) would unwind across the extern "C" boundary back into the host — undefined behaviour on most toolchains, abort on others. These helpers catch the unwind, log a short diagnostic, and return a fallback value the wrapper can hand back to its caller.

Mirrors truce_core::wrapper. The plugin-side framework catches panics going out of plugin code; the host-side framework catches panics going in from plugin code. Same helper shape, opposite direction.

Functions§

run_audio_block
Run a per-audio-block callback body under catch_unwind with no fallback value — caller only cares whether the body panicked.
run_audio_block_with
Run a per-audio-block callback body under catch_unwind with a fallback return value. Returns the body’s value on clean exit, fallback on panic.
run_callable
Convenience: run a plugin callback under catch_unwind and convert a panic into an Error::Panic. Used by the PluginCore / Plugin impl shims when the callback’s natural error type is crate::Result<T>.
run_extern_callback_with
Run an extern "C" plugin callback body (state save / load, parameter formatting, GUI handler) under catch_unwind with a fallback return value. action is logged for debuggability (“save_state”, “load_state”, “format_value”, …).