works with \n as you indicate me , thank you 2016-12-15 19:50 GMT+01:00 Alon Zakai <[email protected]>:
> Lines are buffered before they are printed (since JS can't print a partial > line). Try adding a \n to the end of each line, that might be it. > > On Thu, Dec 15, 2016 at 5:43 AM, claudio daffra <[email protected]> > wrote: > >> I put here full example, i don't know if is this the right way !? >> comple with : >> >> emcc jquery001.cpp -o jquery001.js -s EXPORTED_FUNCTIONS="['_x_click >> ','_webmain']" >> >> >> it seems that all is well, program work well but ... printf >> show always not last printf but prev >> >> >> initial output : >> >> pre-main prep time: 11 ms >> jquery001.js:143 >> jquery001.js:143 enter webmain >> jquery001.js:143 webmain <> >> exit web main is missig : printf ( "\n exit webmain"); >> >> then a 'click' on a element example <emscripten1> and appears : >> >> exit webmain >> jquery001.js:143 enter x_click >> jquery001.js:143 x_click event <x1> >> >> the printf exit web main ... but not printf ( "\n exit x_click"); >> >> what's wrong ? >> >> >> [ jquery001.html ] >> >> >> <!DOCTYPE html> >> <html> >> <head> >> <title>emcc & jquery</title> >> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jque >> ry.min.js"></script> >> </head> >> <body> >> <label id="x1" class="x" >emscripten1</label> >> <label id="x2" class="x" >emscripten2</label> >> </body> >> <script src="jquery001.js"></script> >> <script> >> Module.ccall('webmain', 'number', ['string'],['']); >> </script> >> </html> >> >> [ jquery001.cpp ] >> >> >> #include <stdio.h> >> #include <stdlib.h> >> #include <emscripten.h> >> #include <string.h> >> >> #include <string> >> >> extern "C" >> { >> int x_click( char *s ) >> { >> printf ( "\n enter x_click"); >> printf ( "\n x_click event <%s>",s ); >> printf ( "\n exit x_click"); >> return 0 ; >> } >> int webmain( char *s ) >> { >> printf ( "\n enter webmain"); >> printf ( "\n webmain <%s>",s); >> >> int x = EM_ASM_INT({ >> $('.x').click(function(e) >> { >> Module.ccall('x_click', 'number', ['string'],[e.target.id]); >> >> }); >> >> >> return 0; >> }, NULL); >> printf ( "\n exit webmain"); >> return 0 ; >> } >> } >> >> >> int main ( void ) >> { >> >> return 0 ; >> } >> >> -- >> 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 a topic in the > Google Groups "emscripten-discuss" group. > To unsubscribe from this topic, visit https://groups.google.com/d/ > topic/emscripten-discuss/39c5b679LHE/unsubscribe. > To unsubscribe from this group and all its topics, 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.
