If you are going to use C++ in a web application you will have to connect your code to code that can make changes to the HTML UI. The creators of Emscripten have it all covered but it is not necessarily well documented.
Calling simple C functions is simple but passing complex data structures back and forth can be a bit more tricky.
We also want to leverage the strongly typed Typescript language which will allow us to develop our web app much faster.
There is a good chance that if you are going to write complex software, you will need data storage and manipulation. We are lucky SQLite is there for us, with a small binary footprint, portable, and fully fledged. Let me show you how you can use it from your C++ code with just a bit of setup. And even better: without writing any SQL.
The code for this tutorial is available at https://github.com/skonstant/xptuto/tree/part6_sqlite
SQLite is a Relational Database Management System that supports SQL-92 with plenty of cool things: full-text search, JSON, hierarchical, recursive queries, and more.
It is an embeddable…
As we are dealing with graphical software, we need to make sure our user interface remains responsive. This is why we need multi-threading, and we need to be able to do long running operations in the background and to bring their results back to the foreground.
C++11 brought a fully-fledged multi-threading library into play, and it is portable and easy to use. Much easier than POSIX threads. There are however a few pitfalls we need to be careful of.
The source code is here: https://github.com/skonstant/xptuto/tree/part5_threads
Each graphical toolkit has what we will refer to as the Main Thread. This is…
You can have piles of logic in your application but you need to get your data from somewhere at some point. Typically you will use a ReST API, this seems to have become the standard nowadays. I will show you how to implement your ReST client to produce objects that your view layer can use with minimal effort.
The source code is here: https://github.com/skonstant/xptuto/tree/part4_rest
I took a while to search for a good portable HTTP library and I could not find any that meets my business requirements. These requirements are: Good quality HTTP, Auto-configured from the platform (SSL and Proxy…
The code for this part is available here https://github.com/skonstant/xptuto/tree/part3_gtest
It seems unit testing has become a religion these days. People often forget that writing tests is writing code: it increases the bug surface and the development time. I am not a unit test extremist but in our case, they come in handy.
Because I write graphical software, one feature could be a few screens and a dozen clicks away. So testing it in runtime can quickly become tedious. It is a little easier on Android where you have instant run or whatever they call it these days, and also perhaps…
As our shared layer will be made of data and business logic, the first thing I would like to show is how we can pass data around. For this we will use the GitHub API, playing around with Users and Repositories.
The code is available here https://github.com/skonstant/xptuto/tree/part2_data
Even though we use it only for JNI, Djinni will generate C++ interfaces and records that we will use on the 3 platforms, so we…
The code is in the part1_setup branch of the repository.
Of course we assume you have the tools downloaded and installed, you need XCode on a Mac (I use Appcode but it is not free), Android Studio with the Android NDK and Emscripten. Perhaps also an IDE for C++ like CLion or QtCreator (they both support CMake projects).
I wrote this tutorial on Linux and MacOS, so the file paths and separators are UNIX-like, I do not know if it works on Windows, any feedback is welcome.
│ ├── app
│ │ ├── build.gradle
This series describes a specific technology choice, which I believe is the best for writing business apps that need to have a lot of logic on the client side. I am targeting advanced coders here. Some experience is required to understand this tutorial.
This architecture works, is fast, and is RAD. It produces small binaries and is future proof.
With the advent of smartphones, I have been asked to write software for Android and iOS much more than anything else. …
Highly skilled software engineer focussed on C++ on mobile and web.