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
This section lists APIs which are not considered suitable for general use, but which may be useful to some developers in some circumstances. These include APIs that are difficult or complicated to use, or which are intended primarily for Emscripten developers.
5
+
This section lists APIs that are not suitable for general use, but which may be useful to developers in some circumstances. These include APIs that are difficult or complicated to use, or which are intended primarily for Emscripten developers.
6
6
7
7
.. contents:: Table of Contents
8
8
:local:
9
9
:depth: 1
10
10
11
11
12
12
13
-
14
13
settings.js
15
14
============
16
15
17
16
`settings.js <https://github.com/kripken/emscripten/blob/master/src/settings.js>`_ contains default values and options used in various places by the compiler.
18
17
19
-
.. Warning :: Many **settings.js** options are highly brittle - certain combination of options and some options used with some source code, can cause Emscripten to fail badly. This is intended for use by "power users", and possibly even only people developing Emscripten itself.
18
+
.. Warning :: Many **settings.js** options are highly brittle - certain combinations of options, and combinations of certain options used with some source code, can cause Emscripten to fail badly. This is intended for use by "advanced users", and possibly even only people developing Emscripten itself.
19
+
20
20
21
-
The options are normally set as command line parameters to *emcc*: ::
21
+
The options in **settings.js** are normally set as command line parameters to *emcc*: ::
22
22
23
23
emcc -s OPT=VALUE
24
24
25
25
26
-
While it is possible to edit **settings.js** manually, this is *highly discouraged*. In general **settings.js** defines low-level options that should not be modified. Note also that the compiler changes some options depending on other settings. For example, ``ASSERTIONS`` is disabled in optimized builds (``-O1+``), but enabled by default in default (non-optimized) builds.
26
+
While it is possible to edit **settings.js** manually, this is *highly discouraged*. In general **settings.js** defines low-level options that should not be modified. Note also that the compiler changes some options depending on other settings. For example, ``ASSERTIONS`` is enabled by default, but disabled in optimized builds (``-O1+``).
27
27
28
-
The small number of options that people do need to change should be modified when the tool is invoked. For example, ``EXPORTED_FUNCTIONS``: ::
28
+
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``: ::
``Module.Runtime`` gives access to some low-level things in the runtime. Some of these, for example ``Runtime.stackSave()`` and ``Runtime.stackRestore()`` may be useful for advanced users.
43
-
44
-
42
+
``Module.Runtime`` gives access to low-level runtime functionality. Some of these, for example ``Runtime.stackSave()`` and ``Runtime.stackRestore()`` may be useful for advanced users.
45
43
46
-
emscripten_jcache_printf_()
47
-
===========================
44
+
.. todo:: **HamishW** It would be useful to expand on what is offered by Module.Runtime
48
45
49
-
``emscripten_jcache_printf_()`` is an internal API documented in `emscripten.h <https://github.com/kripken/emscripten/blob/master/system/include/emscripten/emscripten.h>`_.
Copy file name to clipboardExpand all lines: site/source/docs/api_reference/emscripten.h.rst
+7-5Lines changed: 7 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,5 @@
1
+
.. _emscripten-h:
2
+
1
3
================================
2
4
Emscripten.h (ready-for-review)
3
5
================================
@@ -26,12 +28,12 @@ Defines
26
28
27
29
This allows you to declare JavaScript in your C code "inline", which is then executed when your compiled code is run in the browser. For example, the following C code would display two alerts if it was compiled with Emscripten and run in the browser: ::
28
30
29
-
EM_ASM( window.alert(‘hai’));
30
-
window.alert(‘bai’)); )
31
+
EM_ASM( alert(‘hai’));
32
+
alert(‘bai’)); )
31
33
32
34
.. note::
33
35
- Double-quotes (") cannot be used in the inline assembly/JavaScript. Single-quotes (‘) can be used, as shown above.
34
-
- Newlines are supported
36
+
- Newlines (\\n, \\r etc.) are supported in the inline Javascript. Note that any platform-specific issues with line endings in normal JavaScript also apply to inline JavaScript declared using ``EM_ASM``.
35
37
- This works with **asm.js** (it outlines the code and does a function call to reach it).
36
38
- You can’t access C variables with :c:macro:`EM_ASM`, nor receive a value back. Instead use :c:macro:`EM_ASM_INT` or :c:macro:`EM_ASM_DOUBLE`.
37
39
@@ -445,7 +447,7 @@ Functions
445
447
:type file: const char*
446
448
:param requesttype: 'GET' or 'POST'.
447
449
:type requesttype: const char*
448
-
:param param: Request parameters. If the ``requesttype`` is a POST request, this is a POST parameter like ``key=value&key2=value2``.
450
+
:param param: Request parameters for POST requests (see ``requesttype``). The parameters are specified in the same way as they would be in the URL for an equivalent GET request: e.g. ``key=value&key2=value2``.
449
451
:type param: const char*
450
452
:param void* arg: User-defined data that is passed to the callbacks, untouched by the API itself. This may be be used by a callback to identify the associated call.
451
453
:param em_async_wget2_onload_func onload: Callback on successful load of the file. The callback function parameter values are:
@@ -480,7 +482,7 @@ Functions
480
482
:type url: const char*
481
483
:param requesttype: 'GET' or 'POST'.
482
484
:type requesttype: const char*
483
-
:param param: Request parameters. If the ``requesttype`` is a POST request, this is a POST parameter like ``key=value&key2=value2``.
485
+
:param param: Request parameters for POST requests (see ``requesttype``). The parameters are specified in the same way as they would be in the URL for an equivalent GET request: e.g. ``key=value&key2=value2``.
484
486
:type param: const char*
485
487
:param void* arg: User-defined data that is passed to the callbacks, untouched by the API itself. This may be be used by a callback to identify the associated call.
486
488
:param const int free: Tells the runtime whether to free the returned buffer after ``onload`` is complete. If ``false`` freeing the buffer is the receiver's responsibility.
0 commit comments