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.Storable

Description

Provides Storable instances and allocation helpers for the C structs that WasmEdge returns by value. These are used internally when calling the shim layer.

Do not import this module in user code.

Synopsis

WasmEdge_String layout

data CString_ #

Opaque placeholder for the WasmEdge_String C struct layout. Use allocaCString to allocate on the stack.

allocaCString :: (Ptr CString_ -> IO a) -> IO a #

Allocate a stack-allocated WasmEdge_String and pass it to the action.

peekCStringBuf :: Ptr CString_ -> IO (Ptr Word8) #

Peek the buffer pointer from a WasmEdge_String.

peekCStringLen :: Ptr CString_ -> IO Word32 #

Peek the length from a WasmEdge_String.

WasmEdge_Bytes layout

data CBytes_ #

Opaque placeholder for the WasmEdge_Bytes C struct layout.

allocaCBytes :: (Ptr CBytes_ -> IO a) -> IO a #

WasmEdge_Result layout

data CResult_ #

Opaque placeholder for the WasmEdge_Result C struct (single uint32_t).

allocaCResult :: (Ptr CResult_ -> IO a) -> IO a #

peekResultCode :: Ptr CResult_ -> IO Word32 #

Peek the Code field from a WasmEdge_Result.

WasmEdge_ValType layout (8 bytes opaque)

data CValType_ #

Opaque placeholder for the WasmEdge_ValType C struct (8 opaque bytes).

WasmEdge_Value layout (uint128 + ValType = 24 bytes)

data CValue_ #

Opaque placeholder for the WasmEdge_Value C struct.

allocaCValue :: (Ptr CValue_ -> IO a) -> IO a #

Stack-allocated array helpers

withCValTypeArray :: Int -> (Ptr CValType_ -> IO a) -> IO a #

Allocate an array of n CValType_ structs on the stack.

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

Allocate an array of n CValue_ structs on the stack.