File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -48,20 +48,22 @@ Here is a small TinyGo program for use by a WASI host application:
4848``` go
4949package main
5050
51- // go:wasm-module yourmodulename
52- // export add
51+ // go:wasmexport add
5352func add (x , y uint32 ) uint32 {
5453 return x + y
5554}
55+ ```
56+
57+ This compiles the above TinyGo program for use on any WASI Preview 1 runtime:
5658
57- // main is required for the `wasip1` target, even if it isn't used.
58- func main () {}
59+ ``` shell
60+ tinygo build -buildmode=c-shared -o add.wasm -target=wasip1 add.go
5961```
6062
61- This compiles the above TinyGo program for use on any WASI runtime :
63+ You can also use the same syntax as Go 1.24+ :
6264
6365``` shell
64- tinygo build -o main .wasm -target=wasip1 main .go
66+ GOARCH=wasip1 GOOS=wasm tinygo build -buildmode=c-shared -o add .wasm add .go
6567```
6668
6769## Installation
You can’t perform that action at this time.
0 commit comments