tinygo icon indicating copy to clipboard operation
tinygo copied to clipboard

WebAssembly: indicate initialization status of runtime

Open jzabinski-dolios opened this issue 3 years ago • 2 comments

For WebAssembly, the embedder needs to use wasm_exec's run(instance) method in global.Go so that TinyGo's runtime can be initialized prior to calling any of the WebAssembly module's exported functions. But there doesn't seem to be anything in global.Go indicating whether the runtime has been initialized. An easy workaround would be to create a wrapper object for run elsewhere in Javascript, but I feel like it would be useful to store a variable indicating the initialization status of the runtime in global.Go itself.

jzabinski-dolios avatar May 16 '22 15:05 jzabinski-dolios

This seems pretty doable.

dgryski avatar May 19 '22 16:05 dgryski

do any other compilers do this (rust, clang etc)? might be nice to see how.

codefromthecrypt avatar Sep 07 '22 06:09 codefromthecrypt

If this ends up being part of https://github.com/tinygo-org/tinygo/issues/2735 then we could close this one.

dgryski avatar Feb 02 '23 00:02 dgryski