Portability Guidelines — Emscripten 4.0.9-git (dev) documentation (original) (raw)

Fork me on GitHub

Emscripten can be used to compile almost any portable C++/C code to JavaScript.

This section explains what types of code are non-portable (or more difficult to port), and what code can be compiled but will run slowly. Developers can use this information for evaluating the effort to port and re-write code.

Current Web limitations

Code that cannot be compiled

The following types of code would need to be re-written in order to work with Emscripten. (While in theory it might be possible for Emscripten to work around these issues using emulation, it would be very slow.)

Note

Code of this type might be used for conservative garbage collection. You can do conservative scanning when there is no other code on the stack, e.g. from an iteration of the main event loop. Other solutions include the SpillPointers pass in Binaryen.

Code that compiles but might run slowly

Note

Understanding these issues can be helpful when optimising code.

The following types of code will compile, but may not run as fast as expected:

Other issues