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

WasmEdge.Value

Description

Provides functions to encode WasmVal into the C representation and decode it back. These are used internally by VM and Executor when calling WASM functions.

Most users interact with WasmVal directly and never call these functions.

Synopsis

Encoding / decoding

encodeVal :: WasmVal -> (Ptr CValue_ -> IO a) -> IO a #

Encode a single WasmVal into a stack-allocated CValue_.

decodeVal :: Ptr CValue_ -> IO WasmVal #

Decode a WasmVal from a CValue_ pointer.

withValArray :: [WasmVal] -> (Ptr () -> Word32 -> IO a) -> IO a #

Encode a '[WasmVal]' into a C array and pass the array to the action.

peekValArray :: Ptr () -> Word32 -> IO [WasmVal] #

Decode a '[WasmVal]' from a C array of CValue_.

withCValueArray :: Int -> (Ptr CValue_ -> IO a) -> IO a #

Allocate an array of n CValue_ structs on the stack.

ValType conversion

encodeValType :: ValType -> (Ptr CValType_ -> IO a) -> IO a #

Encode a ValType into a stack-allocated CValType_ and pass it to the given action.

withValTypeArray :: [ValType] -> (Ptr CValType_ -> Word32 -> IO a) -> IO a #

Allocate a stack array of CValType_ from a '[ValType]'.

peekValTypes :: Ptr CValType_ -> Word32 -> IO [ValType] #

Decode an array of CValType_ from a C array.