You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 11, 2020. It is now read-only.
Right now, a wasm.Module struct can only hold Functions that use WebAssembly bytecode. To allow interoperability between WASM and Go, it should be possible to use call and call_indirect with Go functions. Furthermore, more complex data structures like struct, map, slice and chan should be able to be passed as arguments, using an intermediate ABI around the module's linear memory.
The text was updated successfully, but these errors were encountered:
Thanks for helping out!
As I understand it, the starting point for this would be to figure out a way to represent all Go types in WebAssembly (which as a bytecode format only allows i32, i64, f32 and f64). An obvious way would be to use i64 to store the raw unsafe.Pointer values, and convert them accordingly while they're in transit from or to Go functions. Another issue would be to make sure that garbage collection doesn't free up these objects, as storing pointers in a way other than unsafe.Pointer discards GC info.
Once we have these design decisions sorted out, we can sketch out a basic Go<->WebAssembly FFI.
Right now, a
wasm.Module
struct can only holdFunction
s that use WebAssembly bytecode. To allow interoperability between WASM and Go, it should be possible to usecall
andcall_indirect
with Go functions. Furthermore, more complex data structures likestruct
,map
,slice
andchan
should be able to be passed as arguments, using an intermediate ABI around the module's linear memory.The text was updated successfully, but these errors were encountered: