I've been compiling with Emscripten, then disassembling with wasm2wat to
try and figure out what is happening in the WebAssembly vs. the JavaScript
glue code. I'm trying to figure out what is going on with EM_ASM. I
compiled the following code:
#include <emscripten.h>
EMSCRIPTEN_KEEPALIVE
void hello() {
EM_ASM({
console.log("hello world!");
});
}
If there is a typo I apologize, I was working on a different computer and
can't copy and paste. Anyway, I see the console.log call in both the
JavaScript glue code and the disassembled WAT.
Here is what I see in the JavaScript:
var ASM_CONSTS = [function() {console.log("hello world!"); }];
Based on this, I was expecting that function to be passed in through the
imports in the WAT, which maybe it is. But inside the WAT I see this:
(data (; 0 ;) (i32.const 1024) "{ console.log(\22hello world!\22); }"))
That line in the WAT made me think that perhaps the code is being passed
from the WebAssembly into a function that uses a JavaScript eval, although
I see no evidence of an eval in the JavaScript code.
Would anyone be willing to help me understand what Emscripten is doing here?
Thanks,
Rick
--
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/emscripten-discuss/aaa156de-8ee5-4539-8f74-c00f005e5aed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.