mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-11 22:43:40 +00:00
wasm: add //go:wasmexport support (#4451)
This adds support for the `//go:wasmexport` pragma as proposed here: https://github.com/golang/go/issues/65199 It is currently implemented only for wasip1 and wasm-unknown, but it is certainly possible to extend it to other targets like GOOS=js and wasip2.
This commit is contained in:
@@ -2,7 +2,8 @@
|
||||
|
||||
package runtime
|
||||
|
||||
import "unsafe"
|
||||
// TODO: this is essentially reactor mode wasm. So we might want to support
|
||||
// -buildmode=c-shared (and default to it).
|
||||
|
||||
type timeUnit int64
|
||||
|
||||
@@ -11,14 +12,6 @@ type timeUnit int64
|
||||
//export __wasm_call_ctors
|
||||
func __wasm_call_ctors()
|
||||
|
||||
//export _initialize
|
||||
func _initialize() {
|
||||
// These need to be initialized early so that the heap can be initialized.
|
||||
heapStart = uintptr(unsafe.Pointer(&heapStartSymbol))
|
||||
heapEnd = uintptr(wasm_memory_size(0) * wasmPageSize)
|
||||
initAll()
|
||||
}
|
||||
|
||||
func init() {
|
||||
__wasm_call_ctors()
|
||||
}
|
||||
@@ -40,3 +33,6 @@ func sleepTicks(d timeUnit) {
|
||||
func ticks() timeUnit {
|
||||
return timeUnit(0)
|
||||
}
|
||||
|
||||
func beforeExit() {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user