HOME

TheInfoList



OR:

Emscripten is an
LLVM LLVM, also called LLVM Core, is a target-independent optimizer and code generator. It can be used to develop a Compiler#Front end, frontend for any programming language and a Compiler#Back end, backend for any instruction set architecture. LLVM i ...
/
Clang Clang () is a compiler front end for the programming languages C, C++, Objective-C, Objective-C++, and the software frameworks OpenMP, OpenCL, RenderScript, CUDA, SYCL, and HIP. It acts as a drop-in replacement for the GNU Compiler ...
-based
compiler In computing, a compiler is a computer program that Translator (computing), translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primaril ...
that compiles C and C++
source code In computing, source code, or simply code or source, is a plain text computer program written in a programming language. A programmer writes the human readable source code to control the behavior of a computer. Since a computer, at base, only ...
to WebAssembly, primarily for execution in web browsers. Emscripten allows applications and libraries written in C or C++ to be compiled ahead of time and run efficiently in web browsers, typically at speeds comparable to or faster than interpreted or dynamically compiled JavaScript. It even emulates an entire
POSIX The Portable Operating System Interface (POSIX; ) is a family of standards specified by the IEEE Computer Society for maintaining compatibility between operating systems. POSIX defines application programming interfaces (APIs), along with comm ...
operating system, enabling programmers to use functions from the
C standard library The C standard library, sometimes referred to as libc, is the standard library for the C (programming language), C programming language, as specified in the ISO C standard.International Organization for Standardization, ISO/International Electrote ...
(libc). With the more recent development of the WebAssembly System Interface (WASI) and WebAssembly runtimes such as Node.js, Wasmtime, and Wasmer, Emscripten can also be used to compile to WebAssembly for execution in non-Web embeddings as well.


Usage

Emscripten has been used to
port A port is a maritime facility comprising one or more wharves or loading areas, where ships load and discharge cargo and passengers. Although usually situated on a sea coast or estuary, ports can also be found far inland, such as Hamburg, Manch ...
a number of C/C++ code bases to WebAssembly, including Unreal Engine 3, SQLite, MeshLab, Bullet physics, AutoCAD, and a subset of the Qt application framework. Other examples of software ported to WebAssembly via Emscripten include the following:


Game engines

The Unity, Defold, and Godot game engines provide an export option to HTML5, utilizing Emscripten. Unreal Engine had this export option but it has been migrated out of the engine to a community member plug in. The Source Engine, has a community developed port for Emscripten dubbed "HalfLife2JS"


Frameworks & toolkits

openFrameworks exports native C++ applications to HTML5 via Emscripten. emscripten-qt permits compiling applications written using the Qt application framework to WebAssembly.


Software archiving

In December 2014, the
Internet Archive The Internet Archive is an American 501(c)(3) organization, non-profit organization founded in 1996 by Brewster Kahle that runs a digital library website, archive.org. It provides free access to collections of digitized media including web ...
launched a
DOSBox DOSBox is a free and open-source MS-DOS emulator. It supports running programs primarily video games that are otherwise inaccessible since hardware for running a compatible disk operating system (DOS) is obsolete and generally unavailab ...
emulator compiled in Emscripten to provide browser-based access to thousands of archived
MS-DOS MS-DOS ( ; acronym for Microsoft Disk Operating System, also known as Microsoft DOS) is an operating system for x86-based personal computers mostly developed by Microsoft. Collectively, MS-DOS, its rebranding as IBM PC DOS, and a few op ...
and PC programs.


See also

* asm.js * Google Native Client (PNaCl) * WebAssembly


References


External links

*
Project page on GitHub

Emscripten Documentation

Porting Examples and Demos

A list of some WebAssembly runtimes
{{JavaScript, state=collapsed Compilers JavaScript libraries Software using the MIT license Software using the University of Illinois/NCSA Open Source License Source-to-source compilers