Add wasi:cli component support, linear memory and globals
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
cb1cec8b13
commit
05488c9783
11 files changed
+518
-52
No files matched your search
@@ -0,0 +1,16 @@
|
||||
;; Core module for a wasi:cli/command component.
|
||||
;; Build with: just run-component hello
|
||||
(module
|
||||
(import "wasi:cli/stdout@0.2.0" "get-stdout" (func $get_stdout (result i32)))
|
||||
(import "wasi:io/streams@0.2.0" "[method]output-stream.blocking-write-and-flush"
|
||||
(func $write (param i32 i32 i32 i32)))
|
||||
(memory (export "memory") 1)
|
||||
(data (i32.const 16) "Hello from wasi:cli!\0a")
|
||||
|
||||
(func (export "wasi:cli/run@0.2.0#run") (result i32)
|
||||
(call $write
|
||||
(call $get_stdout) ;; self: output-stream handle
|
||||
(i32.const 16) ;; ptr
|
||||
(i32.const 21) ;; len
|
||||
(i32.const 64)) ;; retptr for result<_, stream-error>
|
||||
(i32.load8_u (i32.const 64)))) ;; 0 = ok -> exit code 0
|
||||
Reference in new issue
Block a user