| Copyright | (c) 2026 Tushar Adhatrao |
|---|---|
| License | MIT |
| Stability | stable |
| Safe Haskell | None |
| Language | GHC2021 |
WasmEdge.Compiler
Description
The Compiler context compiles WebAssembly bytecodes (.wasm) into
native shared objects (.so / .dylib) ahead-of-time for maximum execution speed.
Synopsis
- data Compiler
- createCompiler :: Maybe Configure -> IO Compiler
- deleteCompiler :: Compiler -> IO ()
- withCompiler :: Maybe Configure -> (Compiler -> IO a) -> IO a
- compileFile :: Compiler -> FilePath -> FilePath -> IO (WasmResult ())
- compileBytes :: Compiler -> ByteString -> FilePath -> IO (WasmResult ())
- unsafeCompilerPtr :: Compiler -> IO (Ptr CompilerTag)
- borrowCompiler :: Ptr CompilerTag -> IO Compiler
Compiler context
createCompiler :: Maybe Configure -> IO Compiler #
Create an AOT Compiler context with optional configuration settings.
deleteCompiler :: Compiler -> IO () #
Delete a 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).