wasmerio / wasmer-go

🐹🕸️ WebAssembly runtime for Go

Home Page:https://pkg.go.dev/github.com/wasmerio/wasmer-go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is it possible to access un-exported data

joesonw opened this issue · comments

Summary

I've compiled following code using tinygo

//go:wasmimport env call
func _call(ptr uint32)

//go:noinline
func call(f func()) {
	ptr := unsafe.Pointer(&f)
	_call(uint32(uintptr(ptr)))
}

and the resulted wasm will call my host function with value a pointer to a memory with two u32: 0 (receiver), 1 (index of function in the table), and the table is as following.

image

And the generated wasm does not export this table, is there any way I can access this function $main.main$1

Additional details

I've got it working with wazero, they exposed a function to retrieve unexported function defined in tables.

I am wondering if it's archievable in wasmer.