Skip to main content

register_host_functions

Function register_host_functions 

Source
pub fn register_host_functions(linker: &mut Linker<HostState>) -> Result<()>
Expand description

Register every oxide import on linker so guest modules can link against them.

This wires dozens of functions (console, canvas, storage, clipboard, timers, HTTP, dynamic module loading, crypto helpers, navigation, hyperlinks, input, audio, UI widgets, etc.) under the Wasm import module name oxide. Each closure captures [Caller] to read HostState from the store: guest pointers are resolved through HostState::memory, and shared handles (Arc<Mutex<…>>) are updated in place.

Call this once when building the linker for a main or child instance; the dynamic loader path also invokes it when instantiating a child module (see the api_load_module import).