The int_sqrt function also needs to be exported, using the EXPORTED_FUNCTIONS option on the commandline, or the EMSCRIPTEN_KEEPALIVE macro in the source. Otherwise, the compiler removes code it thinks is not needed.
On Thu, Mar 24, 2016 at 10:28 AM, Dan Savage < [email protected]> wrote: > Unity3d uses emscripten to run unity in javascript for webgl. I'm trying > to access functions that I wrote in unity from javascript but I get errors > that it cannot find the functions. > > I'm using the documentation examples of communicating found here > > https://kripken.github.io/emscripte...l#interacting-with-code-direct-function-calls > > I've tried the example of putting int_sqrt into the code and then using _ > underscore for direct call to the function. I also tried the ccall and > cwrap. The functions are not found using either of these methods. > > Assertion failed: Cannot call unknown function int_sqrt (perhaps LLVM > optimizations or closure removed it?) > > The function is there because I can call it using a unity specific > SendMessage command that unity included. > Why can't I see it using the underscore or cwrap commands? > > -- > 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.
