wip: rustslop
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
(module
|
||||
;; Correct module name: stdio, not stdout
|
||||
(import "wasi:cli/stdio@0.2.6" "get-stdout"
|
||||
(func $get_stdout (result i32)))
|
||||
|
||||
;; Write and flush a buffer.
|
||||
(import "wasi:io/streams@0.2.0" "blocking-write-and-flush"
|
||||
(func $bwrite (param i32 i32 i32) (result i32)))
|
||||
|
||||
(memory (export "memory") 1)
|
||||
|
||||
(data (i32.const 0) "Hello, World!\n")
|
||||
|
||||
(func (export "main")
|
||||
(local $stdout i32)
|
||||
;; Get the stdout stream handle
|
||||
call $get_stdout
|
||||
local.set $stdout
|
||||
|
||||
;; Write "Hello, World!\n" (14 bytes) to stdout
|
||||
local.get $stdout
|
||||
i32.const 0
|
||||
i32.const 14
|
||||
call $bwrite
|
||||
drop ;; ignore the return value (0 = success)
|
||||
)
|
||||
)
|
||||
Reference in New Issue
Block a user