The web console in your browser shows "Exiting runtime. Any attempt to access the compiled C code may fail from now. If you want to keep the runtime alive, set Module["noExitRuntime"] = true or build with -s NO_EXIT_RUNTIME=1"
When main() finishes, we exit the runtime - call atexit()s etc., like a normal C program. Calling C functions afterwards will generally not work. Building with -s NO_EXIT_RUNTIME=1 fixes things. - Alon On Sat, Apr 26, 2014 at 5:39 AM, <[email protected]> wrote: > Hi there! > > I'm trying to port one thing to JavaScript and I'm very surprised that > <iostream> things refuse to work when called from callbacks. > > In the first example, I'm trying to write a string to `std::cout`. (It can > be replaced with `std:cerr`, the result is the same.) It works well when > called from main function or from simple JavaScript chunk called from that > main function. But it fails when called from setTimeout's callback: > > https://gist.github.com/skalee/11318312 > > Also, I've tried my own custom subclass of `ostring` which uses > `stringbuf` for buffering. (Actually, this example is more important to > me.) Effect is the same — fails in setTimeout's callback, except that error > info takes hundreds of lines: > > https://gist.github.com/skalee/11318888 > > What I'm doing wrong? Could you help me? Thanks in advance for reply. > > Sebastian. > > -- > 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 [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
