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
Copy file name to clipboardExpand all lines: site/source/docs/api_reference/advanced-apis.rst
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,7 @@ While it is possible to edit **settings.js** manually, this is *highly discourag
30
30
31
31
The small number of options that developers may have cause to change should be modified when the *emcc* tool is invoked. For example, ``EXPORTED_FUNCTIONS``: ::
Copy file name to clipboardExpand all lines: site/source/docs/api_reference/preamble.js.rst
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ We call this "``preamble.js``" because Emscripten's output JS, at a high level,
10
10
11
11
The preamble code is included in the output JS, which is then optimized all together by the compiler, together with any ``--pre-js`` and ``--post-js`` files you added and code from any JavaScript libraries (``--js-library``). That means that you can call methods from the preamble directly, and the compiler will see that you need them, and not remove them as being unused.
12
12
13
-
If you want to call preamble methods from somewhere the compiler can't see, like another script tag on the HTML, you need to **export** them. To do so, add them to ``EXPORTED_RUNTIME_METHODS`` (for example, ``-s 'EXPORTED_RUNTIME_METHODS=["ccall", "cwrap"]'`` will export ``ccall`` and ``cwrap``). Once exported, you can access them on the ``Module`` object (as ``Module.ccall``, for example).
13
+
If you want to call preamble methods from somewhere the compiler can't see, like another script tag on the HTML, you need to **export** them. To do so, add them to ``EXPORTED_RUNTIME_METHODS`` (for example, ``-s EXPORTED_RUNTIME_METHODS=ccall,cwrap`` will export ``ccall`` and ``cwrap``). Once exported, you can access them on the ``Module`` object (as ``Module.ccall``, for example).
14
14
15
15
.. note:: If you try to use ``Module.ccall`` or another runtime method without exporting it, you will get an error. In a build with ``-s ASSERTIONS=1``, the compiler emits code to show you a useful error message, which will explain that you need to export it. In general, if you see something odd, it's useful to build with assertions.
16
16
@@ -51,7 +51,7 @@ Calling compiled C functions from JavaScript
51
51
52
52
.. code-block:: none
53
53
54
-
-s EXPORTED_FUNCTIONS="['_main', '_myfunc']"
54
+
-s EXPORTED_FUNCTIONS=_main,_myfunc"
55
55
56
56
(Note that we also export ``main`` - if we didn't, the compiler would assume we don't need it.) Exported functions can then be called as normal:
57
57
@@ -104,7 +104,7 @@ Calling compiled C functions from JavaScript
Copy file name to clipboardExpand all lines: site/source/docs/tools_reference/emcc.rst
+6-1Lines changed: 6 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -96,11 +96,16 @@ Options that are modified or new in *emcc* are listed below:
96
96
97
97
.. note:: If no value is specifed it will default to ``1``.
98
98
99
-
.. note:: Lists can be specified without or without quotes around each element and with or without brackets around the list. For example all the following are equivelent:
99
+
.. note:: Lists can be specified as comma separated strings:
100
100
101
101
::
102
102
103
103
-s EXPORTED_FUNCTIONS=foo,bar
104
+
105
+
.. note:: We also support older list formats that involve more quoting. Lists can be specified with or without quotes around each element and with or without brackets around the list. For example, all the following are equivalent:
0 commit comments