Re:Libc++ 9.0.0 adds explicit support for WASI
by azakai on Friday October 11, 2019 @05:08PM
(#21228486)
Emscripten does use some WASI APIs already, both normally and especially in standalone mode [1].
But yeah, for now WASI and wasm don't provide enough to do things like C++ exceptions, longjmp, etc., so Emscripten supports them using non-WASI APIs.
Native exception handling for wasm is being worked on. If we don't want to wait for that, we could do exceptions using Asyncify [2]. But since we have the JS+wasm option for now, and native support coming, that's maybe not worth it.
[1] https://github.com/emscripten-core/emscripten/wiki/WebAssemb...
I suspect we'll get exception handling at some point, but for now so much stuff just does not work without it. The whole idea of WASI is that it is not JavaScript-specific, so needing some JavaScript code just to get this basic feature is kind of surprising.