#[no_mangle]
pub unsafe extern "C" fn wasm_instance_new(
    store: Option<&mut wasm_store_t>,
    module: Option<&wasm_module_t>,
    imports: Option<&wasm_extern_vec_t>,
    trap: Option<&mut *mut wasm_trap_t>
) -> Option<Box<wasm_instance_t>>
Expand description

Creates a new instance from a WebAssembly module and a set of imports.

Errors

The function can fail in 2 ways:

  1. Link errors that happen when plugging the imports into the instance,
  2. Runtime errors that happen when running the module start function.

The failure is stored in the trap argument; the program doesn’t panic.

Notes

The store argument is ignored. The store from the given module will be used.

Example

See the module’s documentation.