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

WasmEdge.Compiler

Description

The Compiler context compiles WebAssembly bytecodes (.wasm) into native shared objects (.so / .dylib) ahead-of-time for maximum execution speed.

Synopsis

Compiler context

data Compiler #

WasmEdge Ahead-Of-Time compiler context.

createCompiler :: Maybe Configure -> IO Compiler #

Create an AOT Compiler context with optional configuration settings.

deleteCompiler :: Compiler -> IO () #

Delete a Compiler.

withCompiler :: Maybe Configure -> (Compiler -> IO a) -> IO a #

Scoped Compiler.

Compilation

compileFile :: Compiler -> FilePath -> FilePath -> IO (WasmResult ()) #

Compile a WebAssembly file (.wasm) to a native shared library at the output path.

compileBytes :: Compiler -> ByteString -> FilePath -> IO (WasmResult ()) #

Compile an in-memory WebAssembly binary to a native shared library at the output path.

Internal / borrowed pointers

unsafeCompilerPtr :: Compiler -> IO (Ptr CompilerTag) #

Extract the raw pointer of a Compiler.

borrowCompiler :: Ptr CompilerTag -> IO Compiler #

Create a borrowed Compiler from a raw pointer (does not finalize).