Updates all 3rd party dependencies (#802)
wazero has no runtime deps. This updates tools we use as well as dependencies used in comparison with other runtimes. Signed-off-by: Adrian Cole <adrian@tetrate.io>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
## Zig allocation example
|
||||
|
||||
This example shows how to pass strings in and out of a Wasm function defined in Zig, built with `zig build`.
|
||||
This example shows how to pass strings in and out of a Wasm function defined in
|
||||
Zig, built with `zig build`.
|
||||
|
||||
Ex.
|
||||
```bash
|
||||
@@ -9,12 +10,21 @@ wasm >> Hello, wazero!
|
||||
go >> Hello, wazero!
|
||||
```
|
||||
|
||||
Under the covers, [greet.zig](testdata/greet.zig) does a few things of interest:
|
||||
[greet.zig](testdata/greet.zig) does a few things of interest:
|
||||
* Uses `@ptrToInt` to change a Zig pointer to a numeric type
|
||||
* Uses `[*]u8` as an argument to take a pointer and slices it to build back a string
|
||||
* Uses `[*]u8` as an argument to take a pointer and slices it to build back a
|
||||
string
|
||||
|
||||
The Zig code exports "malloc" and "free", which we use for that purpose.
|
||||
|
||||
Note: This example uses `@panic()` rather than `unreachable` to handle errors
|
||||
since `unreachable` emits a call to panic only in `Debug` and `ReleaseSafe` mode.
|
||||
In `ReleaseFast` and `ReleaseSmall` mode, it would lead into undefined behavior.
|
||||
### Notes
|
||||
|
||||
This example uses `@panic()` rather than `unreachable` to handle errors
|
||||
since `unreachable` emits a call to panic only in `Debug` and `ReleaseSafe`
|
||||
mode. In `ReleaseFast` and `ReleaseSmall` mode, it would lead into undefined
|
||||
behavior.
|
||||
|
||||
If building wasm with a pre-release version of Zig 0.10.0, use `-fstage1` to
|
||||
avoid [bugs in the new compiler][1].
|
||||
|
||||
[1]: https://github.com/ziglang/zig/wiki/Self-Hosted-Compiler-Upgrade-Guide#is-it-time-to-upgrade
|
||||
|
||||
BIN
examples/allocation/zig/testdata/greet.wasm
vendored
BIN
examples/allocation/zig/testdata/greet.wasm
vendored
Binary file not shown.
Reference in New Issue
Block a user