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 developers working on the Emscripten core.
settings.js contains default values and options used in various places by the compiler.
警告
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.
The options in settings.js are normally set as command line parameters to emcc:
emcc -sOPT=VALUE
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+
).
备注
For more information on what options can be used to configure Emscripten, read
src/settings.js
or visit
the emsettings page.
The following advanced APIs are documented in preamble.js.
This is marked as internal because it is difficult to use (it has been
optimized for multiple syntaxes to save space in generated code). Normally
developers should instead allocate memory using _malloc()
, initialize it
with setValue()
, etc., but this function may be useful for advanced
developers in certain cases.
slab – An array of data, or a number. If a number, then the size of the block to allocate, in bytes.
allocator – 如何分配内存,参见 ALLOC_*
文件系统API covers the public API that will be relevant to most developers. The following functions are only needed for advanced use-cases (for example, writing a new local file system) or legacy file system compatibility.
For advanced users only.
Legacy v1 compatibility functions.
There are also a small number of additional flag modes:
rs
xw
xw+
xa
xa+