mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-09 21:43:40 +00:00
examples: add example for use with wasm-unknown target
Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
@@ -0,0 +1,18 @@
|
|||||||
|
// this is intended to be used as wasm32-unknown-unknown module.
|
||||||
|
// to compile it, run:
|
||||||
|
// tinygo build -size short -o hello-unknown.wasm -target wasm-unknown -gc=leaking -no-debug ./src/examples/hello-wasm-unknown/
|
||||||
|
package main
|
||||||
|
|
||||||
|
var x int32
|
||||||
|
|
||||||
|
//go:wasmimport hosted echo_i32
|
||||||
|
func echo(x int32)
|
||||||
|
|
||||||
|
//go:export update
|
||||||
|
func update() {
|
||||||
|
x++
|
||||||
|
echo(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user