23 lines
588 B
WebAssembly Text Format
23 lines
588 B
WebAssembly Text Format
(module
|
|
;; Correct module name: stdio, not stdout
|
|
(import "wasi:cli/stdout@0.2.6" "get-stdout"
|
|
(func $get-stdout (result i32)))
|
|
|
|
;; Write and flush a buffer.
|
|
(import
|
|
"wasi:io/streams@0.2.6"
|
|
"[method]output-stream.blocking-write-and-flush"
|
|
(func $print (param i32 i32 i32 i32)))
|
|
|
|
(memory 1)
|
|
(export "memory" (memory 0))
|
|
|
|
(data (i32.const 16) "hello worms\n")
|
|
|
|
(func $hello (export "hello")
|
|
(call $print
|
|
(call $get-stdout)
|
|
(i32.const 16) ;; offset to print
|
|
(i32.const 12) ;; length to print
|
|
(i32.const 32)))) ;; offset for result
|