[gambit-list] Emscripten compiled gambit-c app can not be executed in web browser environment

周宇 zhou6116 at 163.com
Fri Dec 2 03:43:50 EST 2016


Hi Marc,


I was frustrated trying to run emscripten powered gambit-c program on web browser.


The attachment gsi.scm is my program, there's an explicitly main function delcare here to make sure the js code was completely loaded before calling gambit-c _setup() function.
 I put ##repl-debug-main in primordial thread and call _setup() in main to bring up the whole gambit-c system. I use the attachment my-build-script to generate the ultimate gsi.js file.
 I issue echo "(load \"fib\") (pp (time (fib 20)))" | /usr/bin/time node gsi.js, and everything is fine. Unfortunately gsi.js was stuck in a web browser environment. 


Through some experiment, I found the _setup() function never return, the comment in the code said it will create a service thread which executes the rest of the program. 
I think it is the reason why it hung the web browser. I also did another experiment, explicitly make the primordial thread exit. said issue echo "(load \"fib\") (pp (time (fib 20))) ,q" | /usr/bin/time node gsi.js, but the web_trampoline function throw an exception, I trace the exception was threw from macro-run-queue of ##next-heartbeat-interval function


The reason I don't want to use recent gambit to build with emscripten is I am afraid the ultimate js file would be tremendious large. Looking forward your reply and help







-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20161202/5a7ce03f/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gsi.scm
Type: application/octet-stream
Size: 7435 bytes
Desc: not available
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20161202/5a7ce03f/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fib.scm
Type: application/octet-stream
Size: 87 bytes
Desc: not available
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20161202/5a7ce03f/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: my-build-script
Type: application/octet-stream
Size: 1190 bytes
Desc: not available
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20161202/5a7ce03f/attachment-0002.obj>


More information about the Gambit-list mailing list