I followed a great article by Rudy Velthuis about using C ++ classes in DLLs. Everything was golden, except that I need access to some classes that do not have corresponding factories in the C ++ DLL. How can I build an instance of a class in a DLL? The classes in question are defined as
class __declspec(dllexport) exampleClass
{
public:
void foo();
};
Now, without a factory, I don’t have a clear way to instantiate a class, but I know that this can be done since I saw SWIG scripts (.i files) that make these classes available to Python. If Python & SWIG can do this, I guess / hope there is a way to do this in Delphi too.
Now I know little about SWIG, but it looks like it is generating some kind of map for garbled C ++ names? Is it somewhere nearby? If you look at the export from a DLL, I believe that I could directly access the functions and constructor / destructor by index or with a malformed name, but that would be unpleasant; and will it work? Even if I can call the constructor, how can I make the equivalent of "new CClass ();" in Delphi?
source
share