Function wasmedge_sys::ffi::WasmEdge_ExecutorRegister
source · pub unsafe extern "C" fn WasmEdge_ExecutorRegister(
Cxt: *mut WasmEdge_ExecutorContext,
ModuleCxt: *mut *mut WasmEdge_ModuleInstanceContext,
StoreCxt: *mut WasmEdge_StoreContext,
ASTCxt: *const WasmEdge_ASTModuleContext,
ModuleName: WasmEdge_String
) -> WasmEdge_Result
Expand description
Instantiate and register an AST Module into a named module instance.
Instantiate an AST Module with the module name, and return an instantiated
WasmEdge_ASTModuleContext as the result. The caller owns the object and
should call WasmEdge_ModuleInstanceDelete
to destroy it.
Developers can use the WasmEdge_ModuleInstanceListFunction
,
WasmEdge_ModuleInstanceFindFunction
, etc. APIs to retrieve the exported
instances from the result module instance.
After calling this function, the module is registered into the store, and
the other modules can import the instances for linking when instantiation.
Developers should guarantee the life cycle of this registered module
instance, or the error will occur when in execution after the module
instance destroyed if it has been imported by other modules.
\param Cxt the WasmEdge_ExecutorContext to instantiate the module. \param [out] ModuleCxt the output WasmEdge_ModuleInstanceContext if succeeded. \param StoreCxt the WasmEdge_StoreContext to link the imports. \param ASTCxt the WasmEdge AST Module context generated by loader or compiler. \param ModuleName the module name WasmEdge_String for all exported instances.
\returns WasmEdge_Result. Call WasmEdge_ResultGetMessage
for the error
message.