@@ -145,23 +145,6 @@ it (except for ``dlopen(NULL)`` which means to open the current executable,
145145which just works without filesystem integration). That’s basically it - you can
146146then use ``dlopen(), dlsym() ``, etc. normally.
147147
148- System Libraries
149- ================
150-
151- As mentioned earlier, system libraries are handled in a special way by
152- the Emscripten linker, and in dynamic linking, only the main module is
153- linked against system libraries. A possible issue is if a side module
154- depends on a system library that the main does not. If so, you’ll get a
155- runtime error. This section explains what to do to fix that.
156-
157- To get around this, you can build the main module with
158- ``EMCC_FORCE_STDLIBS=1 `` in the environment to force inclusion of all
159- standard libs. A more refined approach is to build the side module with
160- ``-v `` in order to see which system libs are actually needed - look for
161- ``including lib[...] `` messages - and then building the main module with
162- something like ``EMCC_FORCE_STDLIBS=libcxx,libcxxabi `` (if you need
163- those two libs).
164-
165148Code Size
166149=========
167150
@@ -185,6 +168,26 @@ when doing load time dynamic linking.
185168
186169There is also the corresponding ``-sSIDE_MODULE=2 `` for side modules.
187170
171+ System Libraries
172+ ================
173+
174+ As mentioned earlier, system libraries are handled in a special way by the
175+ Emscripten linker, and in dynamic linking, only the main module is linked
176+ against system libraries. When linking the main module it is possible to pass
177+ the side modules on the command line, in which case any system library
178+ dependencies are automatically handled.
179+
180+ However when linking a main module without its side modules (Usually with
181+ ``-sMAIN_MODULE=1 ``) it is possible that required system libraries are not
182+ included. This section explains what to do to fix that by forcing the main
183+ module to be linked against certain libraries.
184+
185+ You can build the main module with ``EMCC_FORCE_STDLIBS=1 `` in the environment
186+ to force inclusion of all standard libs. A more refined approach is to name the
187+ system libraries that you want to explicitly include. For example, with
188+ something like ``EMCC_FORCE_STDLIBS=libcxx,libcxxabi `` (if you need those two
189+ libs).
190+
188191Miscellaneous Notes
189192===================
190193
0 commit comments