I have been using this approach of integrating C++ with mobile for many years now. I have been working on a project created by Dropbox (Djinni) for some time, but they abandoned the project for internal reasons. The community continued the Dropbox project and the Snapchat team also made a fork of it, adding support for Web Assembly and other interesting features. Today, I am a collaborator in both projects.
But the biggest pain was having to rely on Scala-written generators to support a new technology or make a change. Another problem was the generation of a large number of gluecode files to be compiled. And finally, the inability to modify certain things, as they were automatically generated by the tools, making development more focused on the tool rather than the way you would like to work.
Thinking about this for a few months now, I decided to create a project where I do not need a code generator, but I can transfer data quickly between one language and another or between one platform and another, without much effort.
These projects (Djinni, XPLPC and Nativium) couple a library that you generate locally to your actual project (desktop, mobile or web), it is not like Flutter or React, you only pass the business layer to C++ to avoid rewriting, but the presentation layer (UI, animation, etc.) you still continue to use everything native to each platform, because the idea is to have performance in the logic and use what Google and Apple already invest in this UI part.
Because the focus of the platforms is to make the best possible UI and with the best possible performance using their hardware. It does not make sense for me to replace that investment that companies make with another screen design project.
Currently, there are very good projects, such as Flutter, in which I have some apps made with it, but you can see that the part they are always investing in and exchanging is the UI design part. It was Skia, a C++ drawing framework, and now it's Impeller.
These frameworks (Flutter, React and Cordova) have their place in the market, but personally, I do not believe this is the best approach, especially when it comes to projects for large companies. There is a strong connection and dependence on the projects and the companies responsible for the development of these frameworks.
The processing power of C++ is superior to anything currently available, so the idea is to combine good C++ code to process the data and good UI code made by the companies themselves to draw the screens.
Therefore, for me, the best approach to develop applications is still the one I am currently using. It is to use the XPLPC project to create applications by reusing logic code and taking advantage of the UI part of each platform.
In practice, using the approach I am proposing, your development process would be divided into two parts:
- The C++ code will make the HTTP call to your backend, parse the JSON and return a Customer class filled with the user data that was returned in the API.
- The UI code will only present the visual controls and a button that will call the C++ method created.