Duetto Morphs To Cheerp
Written by Kay Ewbank   
Wednesday, 03 September 2014

A C/C++ compiler for the Web has been released. It brings the advantage of bi-directional interoperability between C or C++ code and JavaScript code.



Cheerp (formerly known as Duetto) has been released by Leaning Technologies. It compiles integrated C/C++ applications into JavaScript code for the front end, and native code back end has been released. The intention is that you can use it to port desktop applications to the Web, or to develop interactive Web applications from scratch.

The developers say Cheerp is better than existing compile-to-JS tools because of the features it offers. The first example of this, according to the blog post about the release, is that Cheerp gives you access to browser tools such as DOM and browser APIs with no performance or coding overhead. You can use browser features such as WebGL from your C or C++ code with no need for wrappers or re-implementation. The Cheerp programming guide says that when using any browser API with Cheerp, you are directly accessing the implementation which provided by the browser, so there is no implementation or abstraction layer inside Cheerp.

Another feature of Cheerp is support for bi-directional interoperability between C or C++ code and JavaScript code. The suggestion is that you could have a GUI designed in JavaScript interact with a business logic / engine written in C++, or to take advantage of any pre-existent JS library in addition to the C or C++ libraries.

The dynamic memory management of Cheerp offers the benefit of having C++ objects translated directly to JS objects, without the proxy of an emulated, flat memory space. This means your applications can use the JavaScript VM garbage collector and co-exist with fair, on-demand memory allocation.

You can also debug within the browser with direct referencing of the C++ code. The blog post says that “Cheerp supports the JavaScript Source Maps standard to enable a smooth debugging experience”.

Cheerp compiles to native binary code backend, JavaScript frontend, and automatically generates RPC communication code. You can specify which elements should be compiled where using a function tagging feature that lets you say whether a method is going to be compiled on the backend, frontend, or both.

The final benefit is the standard clang/gcc interface. This means your code can be integrated in existing toolchains. The blog post says you can just add the Web as a new target of your multi-platform application, and have Cheerp work as a drop-in replacement for your current tools.

Cheerp is based on the LLVM/Clang tools, and offers ‘close-to-complete support of C++’, according to the developers. They say they have tested Cheerp on a real-world codebase of around a million line of code, with a result of very few edits being needed to get the code to a form where it could be compiled to JavaScript. Those edits, the developers say, were mainly for stricter type-safety, and only around 0.1% of lines of code were involved, corresponding to a few dozen key patches). The resulting codebase compiles with both Cheerp and standard Clang/GCC compilers.

Cheerp is available as a commercial package or in an open-source version for Linux, Windows and MacOSX.




More Information

Download Cheerp

Cheerp Wiki on GitHub

Related Articles

Asm.js Gets Faster

Java, ASM.js Or Native - Which Is Faster?

Nashorn A New JVM JavaScript


To be informed about new articles on I Programmer, install the I Programmer Toolbar, subscribe to the RSS feed, follow us on, Twitter, Facebook, Google+ or Linkedin,  or sign up for our weekly newsletter.



Google Reduces Support For Python, Dart And Flutter

There are many reports that Google has removed people from its Python, Dart and Flutter teams and possibly more. What does this say about relying on Google as a source of technology for your projects? [ ... ]

Gemini 1.5 Pro Now Available

Google has released Gemini 1.5 Pro with improvements including Native Audio Understanding, System Instructions, and a JSON mode.

More News


raspberry pi books



or email your comment to: comments@i-programmer.info

Last Updated ( Wednesday, 03 September 2014 )