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
logi('Web server root directory: '+os.path.abspath('.'))
1645
-
else:
1651
+
ifoptions.run_server:
1652
+
ifoptions.run_browser:
1646
1653
logv('Web server root directory: '+os.path.abspath('.'))
1654
+
else:
1655
+
logi('Web server root directory: '+os.path.abspath('.'))
1647
1656
1648
1657
ifoptions.android:
1649
-
ifnotoptions.no_browseroroptions.browser_info:
1658
+
ifoptions.run_browseroroptions.browser_info:
1650
1659
ifnotoptions.browser:
1651
1660
loge("Running on Android requires that you explicitly specify the browser to run with --browser <id>. Run emrun --android --list_browsers to obtain a list of installed browsers you can use.")
1652
1661
return1
@@ -1691,7 +1700,7 @@ def run():
1691
1700
ifoptions.browser:
1692
1701
options.browser=unwrap(options.browser)
1693
1702
1694
-
ifnotoptions.no_browseroroptions.browser_info:
1703
+
ifoptions.run_browseroroptions.browser_info:
1695
1704
browser=find_browser(str(options.browser))
1696
1705
ifnotbrowser:
1697
1706
loge('Unable to find browser "'+str(options.browser) +'"! Check the correctness of the passed --browser=xxx parameter!')
logv('Launched browser process with pid='+str(browser_process.pid))
1804
1814
ifoptions.kill_exit:
@@ -1807,7 +1817,7 @@ def run(cmd):
1807
1817
# represent a browser and no point killing it.
1808
1818
ifoptions.android:
1809
1819
browser_process=None
1810
-
elifnotoptions.no_server:
1820
+
elifoptions.run_server:
1811
1821
logi('Now listening at http://%s:%i/'% (options.hostname, options.port))
1812
1822
1813
1823
ifbrowser_process:
@@ -1818,7 +1828,7 @@ def run(cmd):
1818
1828
ifnotoptions.browser:
1819
1829
logv('Try passing the --browser=/path/to/browser option to avoid this from occurring. See https://github.com/emscripten-core/emscripten/issues/3234 for more discussion.')
Copy file name to clipboardExpand all lines: site/source/docs/api_reference/preamble.js.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
@@ -99,7 +99,7 @@ Calling compiled C functions from JavaScript
99
99
100
100
.. note::
101
101
- ``cwrap`` uses the C stack for temporary values. If you pass a string then it is only "alive" until the call is complete. If the code being called saves the pointer to be used later, it may point to invalid data. If you need a string to live forever, you can create it, for example, using ``_malloc`` and :js:func:`stringToUTF8`. However, you must later delete it manually!
102
-
- LLVM optimizations can inline and remove functions, after which you will not be able to "wrap" them. Similarly, function names minified by the *Closure Compiler* are inaccessible. In either case, the solution is to add the functions to the ``EXPORTED_FUNCTIONS`` list when you invoke *emcc* :
102
+
- To wrap a function it must be exported by adding it to the ``EXPORTED_FUNCTIONS`` list when you invoke *emcc*. If a function is not exported, optimizations may remove it, and ``cwrap`` will not be able to find it at runtime. (In builds with ``ASSERTIONS`` enabled, ``cwrap`` will show an error in such a situation; in release builds without assertions, trying to wrap a non-existent function will error, either by returning `undefined` or by returning a function that will error when actually called, depending on how ``cwrap`` optimizes.)
103
103
- ``cwrap`` does not actually call compiled code (only calling the wrapper it returns does that). That means that it is safe to call ``cwrap`` early, before the runtime is fully initialized (but calling the returned wrapped function must wait for the runtime, of course, like calling compiled code in general).
0 commit comments