@@ -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,22 @@ 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. With ``-sMAIN_MODULE=2 `` side module dependencies are
177+ automatically handled, but with ``-sMAIN_MODULE=1 `` it is possible that a side
178+ module depends on a system library that the main does not. This section
179+ explains what to do to fix that by forcing the main module to be linked against
180+ certain libraries.
181+
182+ You can build the main module with ``EMCC_FORCE_STDLIBS=1 `` in the environment
183+ to force inclusion of all standard libs. A more refined approach is to name the
184+ system libraies that you want to explictly include. For example, with something
185+ like ``EMCC_FORCE_STDLIBS=libcxx,libcxxabi `` (if you need those two libs).
186+
188187Miscellaneous Notes
189188===================
190189
0 commit comments