Cheerp C++ To Webassembly Compiler Now Open Source |
Written by Nikos Vaggalis | |||
Tuesday, 11 April 2023 | |||
Cheerp is a C/C++ compiler for Web applications that lets you compile virtually any C/C++ code to WebAssembly and JavaScript. Its latest version 3.0 has been open sourced. Cheerp is used primarily to port existing C/C++ libraries and applications to HTML5, but can also be used to write high-performance Web applications and WebAssembly components from scratch. Using Cheerp, C/C++ code gets compiled into JavaScript/WebAssembly as well as becoming optimised with the right JavaScript interfaces being exposed, and can be easily integrated in a web application. Version 3 was recently released, comes packed with new features. At the same time it was open sourced under the “Apache 2.0 License with LLVM exceptions” license.This is big news for everyone one wanting to use it under more permissive terms since previously it was licensed under the GPLv2 / dual commercial licensing model. Cheerp is part of a family of Webassembly compiling tools alongside CheerpJ, CheerpX for Flash and WebVM. Back in February 2020 we looked at CheerpJ, the Java equivalent, which could be used in the following scenarios :
Behind the scenes CheerpJ requires a full Java SE runtime in WebAssembly and JavaScript which lives inside the browser, plus sporting a JavaScript/DOM interoperability API that allows accessing and manipulating the DOM from Java. In contrast Cheerp for C++ doesn't require such a runtime and directly uses the LLVM bytecode format as the intermediate representation for both object files and libraries. It works its magic as follows:
Or in simple terms: C++ codebase -> Once the .js and .wasm files are generated, it’s a matter of serving those two static files, embedding them into the relevant HTML pages, building functionality on top of the library’s API, and testing whether all is in order.The main file to be invoked is still a .js file, but a .wasm file is also loaded and run from the .js one. While CheerpJ is not an open source product, Cheerp now is. At this point it is important to note that tools from languageX-to-WebAssembly could now prove to be much more useful since WebAssembly has recently broken loose from the browser's constraints and can now be used for running Microservices and Serveless functions or even run Wasm binaries on the command line so that even cross-platform CLI applications can be developed. As such, a permissive license further reinforces the trend towards WebAssembly's wider adoption. More InformationCheerp: A C++ compiler for the Web Related ArticlesCheerpJ Revitalizes Legacy Java Applications Spin Brings WebAssembly To The Cloud Running PostgreSQL Inside Your Browser
To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.
Comments
or email your comment to: comments@i-programmer.info |
|||
Last Updated ( Tuesday, 11 April 2023 ) |