mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-06 20:13:40 +00:00
fae0402fde
See: https://github.com/tinygo-org/tinygo/issues/4314 The os package isn't particularly useful on wasm-unknown, but just like on baremetal systems it's imported by a lot of packages so it should at least be possible to import this package.
23 lines
489 B
Go
23 lines
489 B
Go
// 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
|
|
|
|
// Smoke test: make sure the fmt package can be imported (even if it isn't
|
|
// really useful for wasm-unknown).
|
|
import _ "os"
|
|
|
|
var x int32
|
|
|
|
//go:wasmimport hosted echo_i32
|
|
func echo(x int32)
|
|
|
|
//go:export update
|
|
func update() {
|
|
x++
|
|
echo(x)
|
|
}
|
|
|
|
func main() {
|
|
}
|