github.com/wasilibs/wazerox@v0.0.0-20240124024944-4923be63ab5f/examples/allocation/README.md (about) 1 ## Allocation examples 2 3 The examples in this directory deal with memory allocation concerns in 4 WebAssembly, e.g. How to pass strings in and out of WebAssembly functions. 5 6 ```bash 7 $ go run greet.go wazero 8 wasm >> Hello, wazero! 9 go >> Hello, wazero! 10 ``` 11 12 While the below examples use strings, they are written in a way that would work 13 for binary serialization. 14 15 * [Rust](rust) - Calls Wasm built with `cargo build --release --target wasm32-unknown-unknown` 16 * [TinyGo](tinygo) - Calls Wasm built with `tinygo build -o X.wasm -scheduler=none --no-debug -target=wasi X.go` 17 * [Zig](zig) - Calls Wasm built with `zig build` 18 19 Note: Each of the above languages differ in both terms of exports and runtime 20 behavior around allocation, because there is no WebAssembly specification for 21 it. For example, TinyGo exports allocation functions while Rust and Zig don't. 22 Also, Rust eagerly collects memory before returning from a Wasm function while TinyGo 23 does not. 24 25 We still try to keep the examples as close to the same as possible, and 26 highlight things to be aware of in the respective source and README files.