Skip to main content

WasmEdge_CallingFrameGetMemoryInstance

Function WasmEdge_CallingFrameGetMemoryInstance 

Source
pub unsafe extern "C" fn WasmEdge_CallingFrameGetMemoryInstance(
    Cxt: *const WasmEdge_CallingFrameContext,
    Idx: u32,
) -> *mut WasmEdge_MemoryInstanceContext
Expand description

Get the memory instance by index from the module instance of the current calling frame.

By default, a WASM module has only one memory instance after instantiation. Therefore, developers can use: WasmEdge_CallingFrameGetMemoryInstance(Cxt, 0) to get the memory instance in host function body. This extension is for the WASM multiple memories proposal. After enabling the proposal, there may be more than one memory instance in a WASM module. Developers can use this function to access memory instances that are not at index 0.

\param Cxt the WasmEdge_CallingFrameContext. \param Idx the index of the memory instance in the module instance.

\returns the memory instance, NULL if not found.