Files
tinygo/testdata/wasmexport-noscheduler.go
T
Ayke van Laethem 04a7baec3e wasm: support //go:wasmexport functions after a call to time.Sleep
This fixes a bug where `//go:wasmexport` functions would not be allowed
anymore after a call to `time.Sleep` (when using `-buildmode=default`).
2024-11-08 11:55:38 +01:00

42 lines
749 B
Go

package main
import "time"
func init() {
println("called init")
}
//go:wasmimport tester callTestMain
func callTestMain()
func main() {
// Check that exported functions can still be called after calling
// time.Sleep.
time.Sleep(time.Millisecond)
// main.main is not used when using -buildmode=c-shared.
callTestMain()
}
//go:wasmexport hello
func hello() {
println("hello!")
}
//go:wasmexport add
func add(a, b int32) int32 {
println("called add:", a, b)
return a + b
}
//go:wasmimport tester callOutside
func callOutside(a, b int32) int32
//go:wasmexport reentrantCall
func reentrantCall(a, b int32) int32 {
println("reentrantCall:", a, b)
result := callOutside(a, b)
println("reentrantCall result:", result)
return result
}