Skip to main content

load_program

Function load_program 

Source
pub fn load_program(
    bytes: &[u8],
    hosts: &HostRegistry,
) -> Result<RuntimeProgram, LoadError>
Expand description

Loads a .cdlb bytecode artifact into a runnable RuntimeProgram.

hosts supplies the Rust closures the artifact’s host blocks bind to. Pass an empty HostRegistry for a program that declares none; a program that declares one it does not cover fails to load, naming what is missing.

§Errors

Returns a LoadError if the magic/version header is wrong, the body fails to decode, a dynamic library cannot be re-bound, or a host function cannot be bound to the registry.