Closed skhaz closed 1 year ago
emscripten does a bunch of automatic stuff in the background which you should probably take control of. I recommend implementing a WASI backend for your compiled WebAssembly and directly using the WebAssembly
constructors. You basically have to implement a small subset of the libc library where you provide the means to write to scatter/gather arrays of arrays.
It's a lot of legwork but not too bad. I did this for xxscreeps: https://github.com/laverdet/xxscreeps/blob/52e4cb07b5aad57da1a1654ffec17e47f1aa493b/src/driver/runtime/wasi/index.ts https://github.com/laverdet/xxscreeps/blob/52e4cb07b5aad57da1a1654ffec17e47f1aa493b/src/driver/runtime/module.ts#L80-L203
But the reason you aren't seeing output is because emscripten uses console.log
and you have exported log
instead.
Thank you so much.
I have this C++ code
I compile it with the command
Then, I use
isolated-vm
to run itIt returns undefined and prints nothing.
Is there some way to capture the stdout and stdin? And even better, provide a stdin?
Thank you in advanced