Just in case someone comes later and wants to know - to call JS from
emscripten C++ is a bit non obvious. The wiki has a few terse lines about
the procedure, but actually omits some of the details.
First of all, in C++ you do the following:
extern "C" {
extern void my_js(void* a, void* b);
}
For whatever you want the prototype to be.
Then, you create a JS file which will be linked with your compiled C code.
The format of the JS file is odd:
mergeInto(LibraryManager.library, {
my_js: function(a, b) {
console.log(a + " " + b);
call_into_actual_code(a, b);
}
})
where call_into_actual_code is some other JS function in your normal JS
frontend.
The final step - you don't include the JS file which is linked in with
emscripten into your webpage. The test mentioned in the wiki does have
this information, but its kind of tough to pick out in a 2500 line python
file.
I have to say, this is one amazingly awesome project! Huge thanks to the
team(also please correct any of the above info if its wrong)
--
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.