Emscripten
   HOME

TheInfoList



OR:

Emscripten is an
LLVM LLVM is a set of compiler and toolchain technologies that can be used to develop a front end for any programming language and a back end for any instruction set architecture. LLVM is designed around a language-independent intermediate repre ...
/ Clang-based
compiler In computing, a compiler is a computer program that translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primarily used for programs tha ...
that compiles C and C++
source code In computing, source code, or simply code, is any collection of code, with or without comments, written using a human-readable programming language, usually as plain text. The source code of a program is specially designed to facilitate the ...
to
WebAssembly WebAssembly (sometimes abbreviated Wasm) defines a portable binary-code format and a corresponding text format for executable programs as well as software interfaces for facilitating interactions between such programs and their host environmen ...
(or to a subset of
JavaScript JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of websites use JavaScript on the client side for webpage behavior, of ...
known as
asm.js asm.js is a subset of JavaScript designed to allow computer software written in languages such as C to be run as web applications while maintaining performance characteristics considerably better than standard JavaScript, which is the typical l ...
, its original compilation target before the advent of WebAssembly in 2017), 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 both the system- and user-level application programming in ...
operating system, enabling programmers to use functions from the C standard library (libc). With the more recent development of the WebAssembly System Interface (WASI) and WebAssembly runtimes such as
Node.js Node.js is an open-source server environment. Node.js is cross-platform and runs on Windows, Linux, Unix, and macOS. Node.js is a back-end JavaScript runtime environment. Node.js runs on the V8 JavaScript Engine and executes JavaScript cod ...
, 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 H ...
a number of C/C++ code bases to WebAssembly, including Unreal Engine 3,
SQLite SQLite (, ) is a database engine written in the C programming language. It is not a standalone app; rather, it is a library that software developers embed in their apps. As such, it belongs to the family of embedded databases. It is the mo ...
, 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 Unity may refer to: Buildings * Unity Building, Oregon, Illinois, US; a historic building * Unity Building (Chicago), Illinois, US; a skyscraper * Unity Buildings, Liverpool, UK; two buildings in England * Unity Chapel, Wyoming, Wisconsin, US; a ...
, Godot, and Unreal game engines provide an export option to HTML5, utilizing Emscripten.


Frameworks & toolkits

openFrameworks openFrameworks is an open source toolkit designed for creative coding founded by Zachary Lieberman, Theo Watson and Arturo Castro. OpenFrameworks is written in C++ and built on top of OpenGL. It runs on Microsoft Windows, macOS, Linux, iOS, ...
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 digital library with the stated mission of "universal access to all knowledge". It provides free public access to collections of digitized materials, including websites, software applications/games, music, ...
launched a
DOSBox DOSBox is a free and open-source emulator which runs software for MS-DOS compatible disk operating systems—primarily video games. It was first released in 2002, when DOS technology was becoming obsolete. Its adoption for running DOS games i ...
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 o ...
and PC programs.


See also

*
asm.js asm.js is a subset of JavaScript designed to allow computer software written in languages such as C to be run as web applications while maintaining performance characteristics considerably better than standard JavaScript, which is the typical l ...
* Google Native Client (PNaCl) *
Haxe Haxe is an open source high-level cross-platform programming language and compiler that can produce applications and source code, for many different computing platforms from one code-base. It is free and open-source software, released under the ...
*
WebAssembly WebAssembly (sometimes abbreviated Wasm) defines a portable binary-code format and a corresponding text format for executable programs as well as software interfaces for facilitating interactions between such programs and their host environmen ...


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 NCSA license Source-to-source compilers