Can't you add EMSCRIPTEN_KEEPALIVE in the C++ source where you wrote that int_sqrt function? See examples in the link from before.
On Thu, Mar 24, 2016 at 10:56 AM, Dan Savage < [email protected]> wrote: > So in this case unity3d is doing the compilations so I have no control > over that. Unity has their own method for calling functions which works so > the function must exist somewhere but maybe it's renamed or hidden. I was > hoping there might be a way to interact directly with the function. > > > > On Thursday, March 24, 2016 at 10:30:55 AM UTC-7, Alon Zakai wrote: >> >> 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. > -- 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.
