Skip to main content

WasmEdge_ModuleInstanceCreateWithData

Function WasmEdge_ModuleInstanceCreateWithData 

Source
pub unsafe extern "C" fn WasmEdge_ModuleInstanceCreateWithData(
    ModuleName: WasmEdge_String,
    HostData: *mut c_void,
    Finalizer: Option<unsafe extern "C" fn(arg1: *mut c_void)>,
) -> *mut WasmEdge_ModuleInstanceContext
Expand description

Creation of the WasmEdge_ModuleInstanceContext with host data.

Create a module instance context with exported module name, host data, and host data finalizer for host instances. Developers can use this API to create a module instance for collecting host functions, tables, memories, tags, and globals. When this module instance is destroyed, the host data finalizer will be invoked. The caller owns the object and should call WasmEdge_ModuleInstanceDelete to destroy it.

\param ModuleName the module name WasmEdge_String of this host module to import. \param HostData the host data to set for the module instance. When calling the finalizer, this pointer will be passed as the argument to the finalizer function. \param Finalizer the function to finalize the host data.

\returns pointer to context, NULL if failed.