GraalvmWasiPreview1Builder
WASI Preview 1 host function installer.
Sets up WebAssembly WASI Preview 1 WebAssembly module in GraalWASM Context.
Usage example:
val source = Source.newBuilder("wasm", ByteSequence.create(wasmFile), "proc").build()
Context.newBuilder().engine(engine).build().use { context ->
context.initialize("wasm")
GraalvmWasiPreview1Builder {
host = embedderHost // setup host
}.build(context)
context.eval(source)
val startFunc = context.getBindings("wasm").getMember("proc").getMember("_start")
startFunc.execute()
try {
startFunction.execute()
} catch (re: PolyglotException) {
if (re.message?.startsWith("Program exited with status code") == false) {
throw re
}
Unit
}
}
Content copied to clipboard
Properties
Functions
Link copied to clipboard
Sets implementation of a host object that provides access from the WebAssembly to external host resources.
Link copied to clipboard
Sets memory source used for all operations.