Is there, by chance, any documentation on how -fexceptions/-fwasm-exceptions are actually implemented? What I'd like to understand is why, apparently, a JS exception thrown across C++ frames causes automatic vars in those frames to get destroyed with -fwasm-exceptions but not with -fexceptions:

$ cat test.cc
#include <iostream>
#include <emscripten.h>
#include <emscripten/bind.h>
struct S { ~S() { std::cout << "destructor\n"; } };
EM_JS(void, js4, (), { throw Error(); });
void cpp3() { js4(); };
void cpp2() {
  S s;
  cpp3();
}
EM_JS(void, js1, (), {
  try {
    Module.cpp2();
  } catch (e) {
    console.log("catch");
  }
});
EMSCRIPTEN_BINDINGS(test) { emscripten::function("cpp2", &cpp2); }
int main() { js1(); }

$ em++ -fwasm-exceptions -lembind test.cc
$ node a.out.js destructor
catch

$ em++ -fexceptions -lembind test.cc
$ node a.out.js catch

--
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to emscripten-discuss+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/1b17cdf2-d115-447e-b8e6-9d78c647c872%40gmail.com.

Reply via email to