You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I just met some problems when using the EMSCRIPTEN_KEEPALIVE flag with static function definitions. It seems that for static functions, adding EMSCRIPTEN_KEEPALIVE couldn't guarantee that the code would be preserved, as shown in the following example.
Yes, this is mostly just a artifact of how EMSCRIPTEN_KEEPALIVE works. Currently its implemented as __attribute__((used)).
The core problem is that static functions are internal of the object file so don't even show up in the linker's symbol table. Marking a function as static and exporting it is kind of a contradiction so I don't think its is a huge issues, and is perhaps just something that should be documented somewhere.
Please include the following in your bug report:
Version of emscripten/emsdk:
3.1.74
Hi, I just met some problems when using the
EMSCRIPTEN_KEEPALIVE
flag with static function definitions. It seems that for static functions, addingEMSCRIPTEN_KEEPALIVE
couldn't guarantee that the code would be preserved, as shown in the following example.Thank you very much for your consideration!
Source code (test_keepalive.cpp):
Compilation command:
Result:
The text was updated successfully, but these errors were encountered: