Emscripten 3.0, a build toolchain for WebAssembly using LLVM

Recently the release of the new version of the Emscripten 3.0 compiler was announced, which is characterized by allowing to compile code in C / C ++ and other languages ​​for which LLVM-based frontends are available, in 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 goal development 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 standard C and C ++ library calls (libc, libcxx), C ++ extensions, pthreads-based multithreading, POSIX API, and many multimedia libraries. APIs for integration with the web API and JavaScript code are provided separately.

script supports streaming of SDL2 library output via Canvas, and also provides OpenGL and EGL support through WebGL, allowing you to convert graphics applications and games to WebAssembly.

Virtually any portable C or C ++ code base can be compiled into WebAssembly using EmscriptenFrom 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 code bases to WebAssembly, including commercial code bases such as 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.

Notably there are differences between native runtime and Emscripten, which means that, in general, eIt is necessary to make some changes to the native code. That being said, many applications will only need to change the way they define their main loop and also 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).

From the parseTools.js library a part of the functions was removed, which are mainly used in the project: removePointing, pointingLevels, removeAllPointing, isVoidType, isStructPointerType, isArrayType, isStructType, isVectorType, isStructuralType getStructuralTypeParts, getStructuralType _IntToHex, IEEEUnHex, Compiletime.isPointerType, Compiletime.EStructileType,.

While In the shell.html and shell_minimal.html templates, the output of the error messages that occur during the emscripten operation and issued by the application through stderr it is changed by default to use console.warn instead of console.error.

It is also highlighted that added the ability to specify a specific text encoding used in file names. Encoding can be specified as a suffix when passing the file name, for example "a.rsp.utf-8" or "a.rsp.cp1251").

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

And in the same way, you can consult documentation on the web on how to use Emscripten, a reference site that we can recommend is the Mozilla developer website: https://developer.mozilla.org.

Also, it is important to mention that the project code is distributed under the MIT license. The compiler uses developments from the LLVM project and the Binaryen library is used to generate WebAssembly and optimization. You can check your code source on GitHub.


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: AB Internet Networks 2008 SL
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.