2
votes

for a plugin I need to create a DLL which exports C++ classes. (for Siemens HMI Operate) My problem is, that I want to write this plugin in Delphi. I need to use a lot of my own libs which are all Delphi.

So the question is: Can such a DLL be created with Delphi?

When I open such a plugin DLL (written in Visual C++) in PE Explorer it exports look like this:

?createDialogBar@SlGfwPluginByMakroBase@@UAEPAVSlGfwDialogBar@@ABVQString@@PAVQWidget@@0@Z

public: virtual class SlGfwDialogBar * __thiscall SlGfwPluginByMakroBase::createDialogBar(class QString const &,class QWidget *,class QString const &)
1

1 Answers

5
votes

Can such a DLL be created with Delphi?

No it cannot. You'll need to create the DLL using the specific C++ implementation that the host process expects.

Perhaps the best you can do is to create the plugin DLL in that specific C++ implementation, and then implement the methods of the class by calling into your Delphi code. But the C++ class that is imported by the host process must be implemented using C++. In other words you use C++ to make a bridge between the plugin interface which mandates a specific C++ implementation, and your code which is written in Delphi.