This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Using wasm binaries generated by Golang (dealing with single exported function) #1273
Labels
Z7-question
Issue is a question. Closer should answer.
I'm working on a project to build substrate-compatible Wasm modules using Go language.
We already have a working parity serialization implementation (https://github.com/Joystream/parity-codec-go) and the next step was to try and build some Wasm modules and use them via Substrate's WasmExecutor.
But, the world is full of suffering, and Go's Wasm support is quite quirky. Apparently (as per golang/go#25612), the only exported function ever is "main" which is renamed to "run" but still accepts only a list of strings ("argv").
There are 2 ways of solving this problem: first, fix/augment the Go Wasm compiler to enable exporting other functions in the generated binaries; second, try to use the "run" function as a dispatch one to expose other arbitrary functions. This, in practice, will require not only some clever hacking in the Go code, but also patch the WasmExecutor to catch this special case and adapt to it.
I'm wondering, have anyone ever looked into this?
The text was updated successfully, but these errors were encountered: