Oh nice, I wasn't aware of that. If it is a simple fix, adding an EMSCRIPTEN_EXPORT alias might help to raise awareness IMHO :)
And looking at the docs, maybe a mention near the EXPORTED_FUNCTIONS section would be good (here: https://kripken.github.io/emscripten-site/docs/porting/connecting_cpp_and_javascript/Interacting-with-code.html?highlight=exported_functions#calling-compiled-c-functions-from-javascript-using-ccall-cwrap), there is a small code sample right below that section which has 2x EMSCRIPTEN_KEEPALIVE, but without explaining anywhere else on that page what it does, and it's easy to miss. Cheers, -Floh. Am Donnerstag, 23. Februar 2017 18:16:31 UTC+1 schrieb Alon Zakai: > > > I agree that the need to list exported functions on the linker command > line is a bit cumbersome since the problem leaks into the build system, I > would prefer something like a EM_EXPORT macro which could be put in front > of C functions. > > The EMSCRIPTEN_KEEPALIVE macro in emscripten.h does that, it both keeps > the function from being eliminated as dead code, and exports it. Perhaps > the name could be better, we could add an EMSCRIPTEN_EXPORT alias? > > > https://kripken.github.io/emscripten-site/docs/api_reference/emscripten.h.html#c.EMSCRIPTEN_KEEPALIVE > > On Thu, Feb 23, 2017 at 7:35 AM, Floh <[email protected] <javascript:>> > wrote: > >> I agree that the need to list exported functions on the linker command >> line is a bit cumbersome since the problem leaks into the build system, I >> would prefer something like a EM_EXPORT macro which could be put in front >> of C functions. >> >> Other then that I'm basically fine with the ability to define a C >> function interface, it's quite common for FFI's in other languages also >> only support C and not C++ for the simpler linking model. >> >> Btw, did you see the documentation section about raw pointers ( >> https://kripken.github.io/emscripten-site/docs/porting/connecting_cpp_and_javascript/embind.html#raw-pointers)? >> >> Not sure if this would fix your problem though. >> >> -Floh. >> >> Am Donnerstag, 23. Februar 2017 04:18:46 UTC+1 schrieb Tyler Daniel: >>> >>> Hi, thanks for your reply. >>> >>> Yes, that's the ccall API. I would prefer to avoid ccall because >>> specifying function names on the command line is cumbersome and error >>> prone. The need to declare functions with C linkage is also limiting and >>> just doesn't integrate well with c++ code. >>> >>> I assumed that embind was created to solve these problems, but providing >>> no way to handle my [common] example seems like a major oversight. >>> >>> >> -- >> >> -- 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.
