Link to home
Start Free TrialLog in
Avatar of facr
facr

asked on

C++ Dll

I have some classes written in C++ in a DLL.
How can I use this classes in Delphi?
Avatar of gysbert1
gysbert1

Create a similar pascal function prototype and follow it by external 'MyDllName.dll';

EG:

C++:
int
MyDllFunction(int FirstParam, word SecondParam) {
  // Blaah Blaah Blaah
}

Delphi:
function MyDllFunction(FirstParam :integer; SecondParam :word) :integer; external 'MyDllName.dll';

Then just go ahead and call it in your code ...
Ok, that was calling functions of course.

Structures have to be duplicated in much the same way, only the functions can be called directly from the .dll.

You can thus not create an instance of a class that you only declared in the .dll.

The same limitations apply in Delphi as in C++ with respect to accessing stuff in dll's
ASKER CERTIFIED SOLUTION
Avatar of sperling
sperling

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial