I’m relatively new to DLL importing and function binding. Let’s say I have a C++ project which is a GUI library written fully in OOP aiming to be used in games.
My game project however is written in Delphi. I now want to bind Delphi functions to the ones in the DLL.
I would know how to do this with simple functions, without classes like in C – but what about OOP?
So in short: Can I bind Delphi functions to the ones in a DLL which consists of compiled C++ classes?
Aren’t classes lost during the compilation process?
I’m still coming to grips with many aspects of C++, but hopefully the following makes some kind of sense.
There are some aspects of C++ that I don’t think will translate well via a purely DLL import based mechanism. For example I don’t think that you’ll be able to support polymorphism or method overloading.
However, that doesn’t mean that you can’t make use of classes. I think that the easiest way to convey how this might work is a toy example.
Then export the
extern "C"functions to delphi and use them.I don’t have a compiler handy to test that, and there may be mistakes, however hopefully there is enough there to convey the concept. If there are any gross errors, please let me know and I’ll fix it.