2

How can I use a DLL written in Delphi in my C++ project (console application)?

I have already read about wrappers. Is there an easier way than that? Or how does this method (wrapper) work?

4
  • 1
    This should "just work". Have you tried it? Commented May 16, 2011 at 13:25
  • 2
    Do you need to know how to generate header and lib files? Commented May 16, 2011 at 13:53
  • As I remember there was a strange rule in Borland Delphi/C++ 6 DLL: if you had a function name: FooFunction, you had to look for _FooFunction by GetProcAddress. Additionally there was an application to change the DLL interface from/to Boralnd interface to/from standard DLL interface. link Commented May 16, 2011 at 14:43
  • I used a DLL in c++ long time a go,as i remember there was some borland tool that generate lib from DLL and I used it with my wrapper header tha I written;; Commented Mar 5, 2013 at 17:58

1 Answer 1

1

It is trivial if you are compiling your C++ project with C++Builder. Just include in your code the C++ wrapper headers generated by the Delphi compiler and link your code with the Delphi library stubs.

However I am not sure if you can manage to do it if you do not have access to wrappers, Delphi source code or Delphi compiler. In such a case or if you are not using C++Builder you must apply typical usage of DLLs and follow standard call convention and COM rules if Delphi code is exporting OO features as COM objects.

Sign up to request clarification or add additional context in comments.

2 Comments

@ Craig Stuntz: would you please explain this method? I can't find a good reference for that I'll appreciate if you add an example. thanks a lot
@Alireza: Could you specify if you are interested in the details of using C++Builder?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.