Add import (only for functions for now) and call

This commit is contained in:
Nathan Braswell
2021-07-25 18:10:10 -04:00
parent 3ad51ce19d
commit 6cacd32c00
4 changed files with 61 additions and 17 deletions

View File

@@ -5,6 +5,7 @@
true *ARGV*)
_ (println "out" out)
wasm_code (module
(import "wasi_unstable" "fd_write" (func $fd_write (param i32 i32 i32 i32) (result i32)))
(func $add (param $num i32) (result i32)
(local $tmp1 i32)
(local $tmp2 i32)
@@ -19,6 +20,14 @@
)
(br $test)
drop
(call $fd_write
(i32.const 0) ;; file descriptor
(i32.const 8) ;; *iovs
(i32.const 1) ;; iovs_len
(i32.const 4) ;; nwritten
)
drop
)
(i32.const 11)
(local.get $tmp2)