Cheerp 1.0 (previously duetto) - a C/C++ compiler for Web applications surpassing existing compile-to-JS solutions

Today Leaning Technologies announces the first stable release of Cheerp (formerly known as duetto), a software that compiles integrated C/C++ applications into JavaScript code for the frontend, and native code backend. Cheerp can be used to port desktop applications to the Web, or to develop interactive Web applications from scratch.

With Web applications starting to play a very significant role for both consumer and enterprise users, the need for new, efficient tools for web developers is bigger than ever.

Several tools have emerged in the last years to help programmers in writing large-scale Web application frontends, following the common approach of bringing strongly-typed programming to Web applications. Microsoft TypeScript, Google Dart, Google GWT, Mandreel and, of course, emscripten, are all examples of tools which compile existing or newly developed strongly-typed languages to JavaScript.

We present Cheerp, a C/C++ compiler for the Web. Cheerp surpasses the features of existing compile-to-JS approaches by providing:

  • Fully transparent access to any browser feature (DOM, browser APIs, etc.) with no performance or coding overhead. Allow your C/C++ code to access browser functions (e.g. WebGL) simply through a clean interface, without need of wrappers or reimplementations.

  • Bi-directional, lightweight, full interoperability between C/C++ code and JavaScript code. This allows e.g. to 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 C/C++ libraries)

  • Dynamic memory management. C++ objects are translated directly to JS objects, without the proxy of an emulated, flat memory space. Allow your applications to exploit the JavaScript VM garbage collector and co-exist with fair, on-demand memory allocation.

  • In-browser debugging capability with direct referencing of the C++ code. Cheerp supports the JavaScript Source Maps standard to enable a smooth debugging experience.

  • Integrated client-server application development in a single codebase. Cheerp compiles to native binary code backend, JavaScript frontend, and automatically generates RPC communication code. A simple function tagging solution allows to specify if a method is going to be compiled on the backend, frontend, or both.

  • Standard clang/gcc interface for easy integration in existing toolchains. 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 rock-solid foundations of the LLVM/Clang tools. This means enjoying a industry-standard compiler, a full-range of compile time optimizations, and close-to-complete support of C++. And when we say close-to-complete we really mean it.

We have battle tested Cheerp on a ~1 Million lines real-world codebase from an early private client and very few edits has been required to compile the whole codebase to JavaScript, the vast majority of which are for stricter type-safety (around 0.1% of lines of code impacted, corresponding to a few dozen key patches). The resulting codebase compiles with both Cheerp and standard Clang/GCC compilers.

For an open-source example of a large-scale C++ codebase ported using Cheerp, have a look at the bullet physics library.

Cheerp is offered both as a free and open-source software, as well as in a commercial package. Cheerp is available for Linux, Windows and MacOSX, and can be downloaded here.

You can follow us on twitter (@leaningtech) and visit our website to receive all our updates.

For additional technical information on Cheerp, please visit our wiki or our blog.

comments powered by Disqus