I have a large application written in Delphi. I want to renew it, starting with the user interface. I thought about using the new Qt. During the process of renewing it, I want to change to C++ as the programming language.
Is there a way to gradually rewrite the application (starting with the UI) to change to C++?
Thank you for your help.
The best course of action highly depends on the C++ development environment.
If it is C++ Builder you have two possibilities:
Use runtime packages instead of normal DLLs. This will spare you much headaches when it comes to string marshalling and mapping class hierarchies to flat DLL functions.
Use mixed code. You can mix Delphi/Pascal code with C++ code in the same project. (Only one language in a single module/unit though)
If it is any other C++ compiler:
Go the way you proposed with DLLs. You have to create some kind of layer/facade to map your classes’ functionality to flat DLL functions.
If you want to go the plain DLL way even though you are using C++ Builder you can try using a shared memory manager like ShareMem (comes with Delphi) or FastMM (SourceForge) to allow passing of
strings instead ofPChars.Create .objs instead of .dcus so both compilers work with the same output format. Then link them directly into you C++ program. This is essentially the same as with creating a DLL, but it’s static. You will spot certain kinds of errors at compile time rather than runtime.