Emscripten 3.0, a build toolchain for WebAssembly using LLVM

The release of the new version of the Emscripten 3.0 compiler was recently announced , which is characterized by allowing the compilation of code in C/C++ and other languages ​​for which LLVM-based frontends are available, into a low-level universal middleware WebAssembly.

The main function of this compilation is for its subsequent integration with JavaScript Projects, run in a web browser, and use in Node. Js or create cross-platform standalone applications that run with the wasm runtime.

About Emscripten

The main development goal of the Emscripten project is to create a tool that allows you to run code on the Web, regardless of the programming language in which it is written.

Compiled applications can use calls to standard C and C++ libraries (libc, libcxx), C++ extensions, pthread-based multithreading, POSIX APIs, and many multimedia libraries. APIs for integration with the Web API and JavaScript code are provided separately.

Emscripten supports streaming SDL2 library output through Canvas , and also provides OpenGL and EGL support via WebGL, enabling the conversion of graphics applications and games to WebAssembly.

Virtually any portable C or C++ codebase can be compiled into WebAssembly using Emscripten , from high-performance games that need to render graphics, play sounds, and load and process files, to application frameworks like Qt. Emscripten has already been used to convert a very long list of real-world codebases to WebAssembly, including commercial codebases like Unreal Engine 4 and Unity Engine.

In addition to compiling C / C ++ code, projects are developed separately to ensure that interpreters and virtual machines for Lua, C #, Python, Ruby, and Perl start in the browsers. It is also possible to apply non-Clang interfaces to LLVM available for languages ​​such as Swift, Rust, D, and Fortran.

It's worth noting that there are differences between the native runtime environment and Emscripten, meaning that some changes to the native code are usually necessary . That said, many applications will only need to change how they define their main loop and modify their file handling to accommodate browser/JavaScript limitations.

There are also limitations that can make some code easier to migrate - read the Portability Guidelines to determine where you may need to spend more effort.

Main new features of Emscripten 3.0

In this new version that is presented, the musl C library used in emscripten has been updated to version 1.2.2 (version 1.1.15 was used in the Emscripten 2.x branch).

The following functions were removed from the parseTools.js library, which are mainly used in the project: removePointing, pointingLevels, removeAllPointing, isVoidType, isStructPointerType, isArrayType, isStructType, isVectorType, isStructuralType, getStructuralTypeParts, getStructuralType, _IntToHex, IEEEUnHex, Compiletime.isPointerType, Compiletime.isStructType, Compiletime.INT_TYPES, isType.

Whereas in the shell.html and shell_minimal.html templates, the output of error messages that occur during the emscripten operation and are issued by the application via stderr is changed by default to use console.warn instead of console.error.

It is also worth noting that the ability to specify a specific text encoding used in filenames has been added. The encoding can be specified as a suffix when passing the filename, for example, "a.rsp.utf-8" or "a.rsp.cp1251".

Finally, if you are interested in learning more about Emscripten, you can check the project details on its official website.

Similarly, you can consult documentation on the web about how to use Emscripten; a reference site we can recommend is the Mozilla developer website: https://developer.mozilla.org.

Furthermore, it's important to mention that the project's code is distributed under the MIT license. The compiler uses developments from the LLVM project, and the Binaryen library is used for WebAssembly generation and optimization. You can view its source code on GitHub.


Add as preferred source in Google