| Copyright | (c) 2026 Tushar Adhatrao |
|---|---|
| License | MIT |
| Stability | stable |
| Safe Haskell | None |
| Language | GHC2021 |
WasmEdge.Configure
Description
The Configure context controls which WASM proposals are enabled,
how the compiler behaves, and which built-in host modules are registered.
Example:
import WasmEdge.Configure import WasmEdge.Types main :: IO () main = withConfigure $ cfg -> do addProposal cfg SIMD addProposal cfg Threads setMaxMemoryPage cfg 65536 setRunMode cfg RunModeAOT -- pass cfg to VM or Executor...
Synopsis
- data Configure
- createConfigure :: IO Configure
- deleteConfigure :: Configure -> IO ()
- withConfigure :: (Configure -> IO a) -> IO a
- addProposal :: Configure -> Proposal -> IO ()
- removeProposal :: Configure -> Proposal -> IO ()
- hasProposal :: Configure -> Proposal -> IO Bool
- setWasmStandard :: Configure -> WasmStandard -> IO ()
- addHostRegistration :: Configure -> HostRegistration -> IO ()
- removeHostRegistration :: Configure -> HostRegistration -> IO ()
- hasHostRegistration :: Configure -> HostRegistration -> IO Bool
- setMaxMemoryPage :: Configure -> Word32 -> IO ()
- getMaxMemoryPage :: Configure -> IO Word32
- setRunMode :: Configure -> RunMode -> IO ()
- getRunMode :: Configure -> IO RunMode
- setForceInterpreter :: Configure -> Bool -> IO ()
- isForceInterpreter :: Configure -> IO Bool
- data CompilerOptions = CompilerOptions {}
- defaultCompilerOptions :: CompilerOptions
- setCompilerOptions :: Configure -> CompilerOptions -> IO ()
- getCompilerOptions :: Configure -> IO CompilerOptions
- data StatisticsOptions = StatisticsOptions {}
- defaultStatisticsOptions :: StatisticsOptions
- setStatisticsOptions :: Configure -> StatisticsOptions -> IO ()
- getStatisticsOptions :: Configure -> IO StatisticsOptions
- unsafeConfigurePtr :: Configure -> IO (Ptr ConfigureTag)
- borrowConfigure :: Ptr ConfigureTag -> IO Configure
Configure context
Opaque WasmEdge configuration context.
Create with createConfigure or use withConfigure for scoped use.
createConfigure :: IO Configure #
Create a new Configure with default settings.
The caller is responsible for calling deleteConfigure or using withConfigure.
deleteConfigure :: Configure -> IO () #
withConfigure :: (Configure -> IO a) -> IO a #
Proposals
setWasmStandard :: Configure -> WasmStandard -> IO () #
Set all proposals to match a standard preset.
Host registrations
addHostRegistration :: Configure -> HostRegistration -> IO () #
Enable a built-in host module (e.g., WASI).
removeHostRegistration :: Configure -> HostRegistration -> IO () #
Disable a built-in host module.
hasHostRegistration :: Configure -> HostRegistration -> IO Bool #
Check whether a host module is registered.
Memory limits
setMaxMemoryPage :: Configure -> Word32 -> IO () #
Set the maximum number of memory pages (default: 65536 = 4 GiB).
getMaxMemoryPage :: Configure -> IO Word32 #
Get the current maximum memory page count.
Run mode (0.18+)
setRunMode :: Configure -> RunMode -> IO () #
Set the execution run mode.
getRunMode :: Configure -> IO RunMode #
Get the current run mode.
Interpreter options
setForceInterpreter :: Configure -> Bool -> IO () #
isForceInterpreter :: Configure -> IO Bool #
Compiler options
data CompilerOptions #
AOT compiler options bundle.
Constructors
| CompilerOptions | |
Fields
| |
Instances
| Show CompilerOptions # | |
Defined in WasmEdge.Configure Methods showsPrec :: Int -> CompilerOptions -> ShowS # show :: CompilerOptions -> String # showList :: [CompilerOptions] -> ShowS # | |
| Eq CompilerOptions # | |
Defined in WasmEdge.Configure Methods (==) :: CompilerOptions -> CompilerOptions -> Bool # (/=) :: CompilerOptions -> CompilerOptions -> Bool # | |
setCompilerOptions :: Configure -> CompilerOptions -> IO () #
Statistics options
data StatisticsOptions #
Constructors
| StatisticsOptions | |
Fields | |
Instances
| Show StatisticsOptions # | |
Defined in WasmEdge.Configure Methods showsPrec :: Int -> StatisticsOptions -> ShowS # show :: StatisticsOptions -> String # showList :: [StatisticsOptions] -> ShowS # | |
| Eq StatisticsOptions # | |
Defined in WasmEdge.Configure Methods (==) :: StatisticsOptions -> StatisticsOptions -> Bool # (/=) :: StatisticsOptions -> StatisticsOptions -> Bool # | |
setStatisticsOptions :: Configure -> StatisticsOptions -> IO () #
Internal / borrowed pointers
unsafeConfigurePtr :: Configure -> IO (Ptr ConfigureTag) #
Extract the underlying pointer for passing to other contexts (unsafe).
borrowConfigure :: Ptr ConfigureTag -> IO Configure #
Create a borrowed Configure context from an existing pointer.