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 Clang is a compiler front end for the C, C++, Objective-C, and Objective-C++ programming languages, as well as the OpenMP, OpenCL, RenderScript, CUDA, and HIP frameworks. It acts as a drop-in replacement for the GNU Compiler Collection ...
-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 that ...
that compiles C and C++
source code In computing, source code, or simply code, is any collection of code, with or without comment (computer programming), comments, written using a human-readable programming language, usually as plain text. The source code of a Computer program, p ...
to WebAssembly (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 Website, websites use JavaScript on the Client (computing), client side ...
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 inte ...
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, 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 ...
a number of C/C++ code bases to WebAssembly, including
Unreal Engine 3 Unreal Engine (UE) is a 3D computer graphics game engine developed by Epic Games, first showcased in the 1998 first-person shooter game ''Unreal''. Initially developed for PC first-person shooters, it has since been used in a variety of genres ...
, SQLite, MeshLab, Bullet physics.
AutoCAD AutoCAD is a commercial computer-aided design (CAD) and drafting software application. Developed and marketed by Autodesk, AutoCAD was first released in December 1982 as a desktop app running on microcomputers with internal graphics controllers. ...
, and a subset of the Qt application framework. Other examples of software ported to WebAssembly via Emscripten include the following:


Game engines

The Unity, Godot, and Unreal game engines provide an export option to HTML5, utilizing Emscripten.


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