Add Zig C-code WASI app (#298)

opam-2.0.0
phaleth 3 years ago committed by GitHub
parent c7cd9d8be6
commit f9581d251b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -100,6 +100,26 @@ $ wasm3 hello.wasm
Hello, world!
```
### Zig C-code WASI app
Create `hello.c`:
```c
#include <stdio.h>
int main() {
printf("Hello, %s!\n", "world");
return 0;
}
```
Build and run:
```sh
$ zig build-exe -O ReleaseSmall -target wasm32-wasi hello.c -lc
$ wasm3 hello.wasm
Hello, world!
```
## Zig library
Create `add.zig`:

Loading…
Cancel
Save