wasmedge-hs-0.17.1.0: Haskell bindings for the WasmEdge WebAssembly runtime
Copyright(c) 2026 Tushar Adhatrao
LicenseMIT
Stabilityinternal
Safe HaskellNone
LanguageGHC2021

WasmEdge.Internal.FFI.Instance

Description

MemoryType, MemoryInstance, GlobalType, GlobalInstance, TagType (0.18+), TagInstance (0.18+), CallingFrame, ModuleInstance.

Synopsis

FunctionType

FunctionInstance

Host function callback type

type RawHostFuncT = Ptr () -> Ptr CallingFrameTag -> Ptr () -> Word32 -> Ptr () -> Word32 -> Ptr CResult_ -> IO () #

The raw C type of a WasmEdge host function callback: WasmEdge_Result callback(void* data, const WasmEdge_CallingFrameContext*, const WasmEdge_Value* params, uint32_t param_len, WasmEdge_Value* returns, uint32_t return_len)

We use 'Ptr ()' for the value arrays since WasmEdge_Value is opaque at this level; the public API converts them.

This callback is safe because it calls back into Haskell.

mkHostFuncWrapper :: RawHostFuncT -> IO (FunPtr RawHostFuncT) #

Wrap a Haskell RawHostFuncT into a C function pointer. The returned FunPtr must be freed with freeHaskellFunPtr when the function instance is deleted.

TableType

c_TableTypeCreate :: Ptr CValType_ -> CBool -> Word64 -> Word64 -> CBool -> CBool -> IO (Ptr TableTypeTag) #

Create a TableType.

c_TableTypeGetLimit :: Ptr TableTypeTag -> IO (Ptr ()) #

Get the limit of a table type. Returns (hasMax, min, max). We call the individual getter functions.

TableInstance

MemoryType

MemoryInstance

GlobalType

GlobalInstance

CallingFrame

ModuleInstance

c_ModuleInstanceCreateWithData :: Ptr CString_ -> Ptr () -> FunPtr (Ptr () -> IO ()) -> IO (Ptr ModuleInstanceTag) #

Create with host data and a finalizer for the data.

Limit helper

c_LimitGetInfo :: Ptr () -> Ptr CBool -> Ptr Word64 -> Ptr Word64 -> Ptr CBool -> Ptr CBool -> IO () #

Inspect limit info via our C helper

TagType (0.18+)

TagInstance (0.18+)

ModuleInstance tag operations

c_ModuleInstanceAddFunction :: Ptr ModuleInstanceTag -> Ptr CString_ -> Ptr FunctionInstanceTag -> IO () #

Add a FunctionInstance to a ModuleInstance (moves ownership into module).