Many people know that you can mix C++ and Delphi in one app, however, not everyone knows how to implement this technique. Whether you are planning to develop windows 10 apps, iOS, or Android applications, you might find great reasons why combining two different programming languages can be extremely beneficial. In this video from the recently concluded DelphiCon 2021, David Millington will share with us what C++ builder can offer to your Delphi app and how surprisingly easy this technique can be done.
Why would you build an app out of two programming languages?
A programming language is called a language for a reason. It is a way to communicate into express intent. Interestingly, the way that a language is designed makes some languages better for some purposes than others. Some languages are good at data processing while some are writing algorithms that are very easy to understand or to read. Some languages like Delphi are connecting to user interfaces and some are being efficient for performance. This means that you can choose the languages you use based on your intent. But the key is, you are not limited to one language and you can always mix and match languages based on your purpose.
How to call C++ from Delphi?
The key in calling between languages is binary compatibility. In this video, David will explain everything about this binary compatibility as well as the differences between Application Programming Interface (API) and Application Binary Interface (ABI). Here, we will learn how to call C++ from Delphi not just by writing C++ but also by using an open-source C++ library. Mixing the two aforementioned languages, Delphi and C++, lets you write most of your app in Delphi but bring in some C++ fast-compile performance or some of the vast number of C++ libraries that are available.
The session will provide an actual demo showcasing an existing Delphi app and will guide us through the process of calling C++ from Delphi through a method and also by using an open-source C++ Library. Here, we will see the benefits of using C++ and how it can effectively optimize the performance by getting about 8 times speedup from the equivalent Delphi code. If you want to know how to use C++ Builder to extend the reach of your Delphi app, feel free to watch the video below.