Emscripten - LLVM to Web Compiler

Mar 02, 2020 • ☕️ 1 min read

Emscripten compiles C and C++ to WebAssembly using LLVM and Binaryen. Emscripten output can run on the Web, in Node.js, and in wasm runtimes. Using Emscripten you can:

  • Compile C and C++ code into JavaScript
  • Compile any other code that can be translated into LLVM bitcode into JavaScript.
  • Compile the C/C++ runtimes of other languages into JavaScript, and then run code in those other languages in an indirect way (this has been done for Python and Lua)!

Emscripten provides Web support for popular portable APIs such as OpenGL and SDL2, allowing complex graphical native applications to be ported, such as the Unity game engine and Google Earth. It can probably port your codebase, too!

While Emscripten mostly focuses on compiling C and C++ using Clang, it can be integrated with other LLVM-using compilers (for example, Rust has Emscripten integration, with the wasm32-unknown-emscripten and asmjs-unknown-emscripten targets).

Practically any portable C or C++ codebase can be compiled into JavaScript using Emscripten, ranging from high performance games that need to render graphics, play sounds, and load and process files, through to application frameworks like Qt.

Emscripten

This is a high level view of the Emscripten toolchain, the main tool is the Emscripten Compiler Frontend (emcc). This is a drop-in replacement for a standard compiler like gcc.

The whole toolchain is delivered in the Emscripten SDK, and can be used on Linux, Windows or macOS.

Emscripten has been used to port Unreal Engine 3, SQLite, MeshLab, Bullet physics, AutoCAD,and the Qt application framework.

Reading More

Beloved CSS Frameworks

Pros and cons of using CSS frameworks like Bootstrap, Foundation, Materialize CSS, Semantic UI, Tailwind, Ant Design

On temptation of Dark Mode

You don't know whether Dark Mode is overhyped or necessary but you know there is a real temptation of adding it to your sites

CocoaPods, Carthage and SwiftPM. Choose it wisely

When we start with any platforms we will always ask “How can I integrate third party libs into my project?”. There is always a naive solution is copying the source manually into your project but you only use this in rare situations when you know what you’re doing

What's Wrong with CSS?

Some noted problems that might hold CSS back and open up new development of preprocessors or CSS-in-JS