File tree 1 file changed +8
-6
lines changed
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:
48
48
``` go
49
49
package main
50
50
51
- // go:wasm-module yourmodulename
52
- // export add
51
+ // go:wasmexport add
53
52
func add (x , y uint32 ) uint32 {
54
53
return x + y
55
54
}
55
+ ```
56
+
57
+ This compiles the above TinyGo program for use on any WASI Preview 1 runtime:
56
58
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
59
61
```
60
62
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+ :
62
64
63
65
``` 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
65
67
```
66
68
67
69
## Installation
You can’t perform that action at this time.
0 commit comments