You can call C functions using ccall or cwrap, see our in-flux docs,

http://kripken.github.io/emscripten-site/docs/coding/connecting_cpp_and_javascript/Interacting-with-code.html

Note the EXPORTED_FUNCTIONS stuff there, you need that to keep the code
alive in the output.

- Alon



On Fri, Aug 1, 2014 at 1:46 AM, Yusuf Afifi <[email protected]>
wrote:

> Hey guys,
>
> I just started experimenting with emscripten today ... i was able to run
> emcc and then run node.js on a.out.js no problem as long as there is a main
> function to call
>
> my question is ... how does that work with functions ? i'd like to be able
> to call a function that i defined purely in a cpp file from javascript
>
> i already tried searching for the function name within a.out.js but i
> didn't find it ... so i realized there is something serious i don't
> understand here :)
>
>
> all what i'm trying to do here is port my c++ code to js ... without
> having to re-write ... is that possible ?
>
> --
> 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.

Reply via email to