File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
site/source/docs/api_reference Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -899,15 +899,19 @@ Compiling
899899
900900.. c:macro:: EMSCRIPTEN_KEEPALIVE
901901
902- Forces LLVM to not dead-code-eliminate a function.
903-
904- This also exports the function, as if you added it to :ref:`EXPORTED_FUNCTIONS <faq-dead-code-elimination>`.
902+ Tells the compiler and linker to preserve a symbol, and export it, as if you
903+ added it to :ref:`EXPORTED_FUNCTIONS <faq-dead-code-elimination>`.
905904
906905 For example: ::
907906
908907 void EMSCRIPTEN_KEEPALIVE my_function() { printf ("I am being kept alive\n "); }
909908
910-
909+ Note that this will only work if the object file in which the symbol is
910+ defined is otherwise included by the linker. If the object file is part of an
911+ archive, and is not otherwise referenced the linker will not include it at all
912+ and any symbols in the object file will not be included or exported. One way
913+ to work around this limitation is to use the ``-Wl,--whole-archive `` /
914+ ``-Wl,--no-whole-archive `` flags on either side of the archive file.
911915
912916
913917Worker API
You can’t perform that action at this time.
0 commit comments