kubkon/zig-wasi-tutorial
Fork: 1 Star: 25 (更新于 2024-11-29 09:38:59)
license: MIT
Language: Zig .
Zig version of WASI tutorial https://github.com/bytecodealliance/wasmtime/blob/master/docs/WASI-tutorial.md
zig-wasi-tutorial
Zig's take on the official WASI tutorial. Hopefully, this tutorial will serve as a decent intro to WASI from Zig lang.
Building
At the time of writing (May 19th, 2020), WASI support in Zig has only just been merged into upstream. Therefore, to build the tutorial you'll need to get your hands on the nightly Zig which can be found here.
After you've successfully installed nightly Zig, simply run
$ zig build
Note that for your convenience, I've made wasm32-wasi
target the default in build.zig
, so there's
no need to specify the target manually.
You should now have the compiled WASI module in zig-cache/bin/main.wasm
.
Running
If you haven't already, go and get yourself a fresh copy of wasmtime
.
Next, create some sample input
$ echo "WASI is really cool!" > in.txt
Run it using wasmtime
$ wasmtime --dir=. zig-cache/bin/main.wasm in.txt out.txt
As a result, you should now have out.txt
file created with the same contents as in.txt
.
最近版本更新:(数据更新于 1970-01-01 00:00:00)
kubkon/zig-wasi-tutorial同语言 Zig最近更新仓库
2024-11-29 19:55:48 oven-sh/bun
2024-09-07 03:02:03 andrewrk/poop
2024-09-03 04:34:45 tigerbeetle/tigerbeetle
2024-06-07 14:02:54 ziglang/zig
1970-01-01 00:00:00 zigcc/zig-cookbook