github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/src/examples/hello-wasm-unknown/main.go (about)

     1  // this is intended to be used as wasm32-unknown-unknown module.
     2  // to compile it, run:
     3  // tinygo build -size short -o hello-unknown.wasm -target wasm-unknown -gc=leaking -no-debug ./src/examples/hello-wasm-unknown/
     4  package main
     5  
     6  var x int32
     7  
     8  //go:wasmimport hosted echo_i32
     9  func echo(x int32)
    10  
    11  //go:export update
    12  func update() {
    13  	x++
    14  	echo(x)
    15  }
    16  
    17  func main() {
    18  }