Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8744015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:46:35+00:00 2026-06-13T11:46:35+00:00

I have a dll with exporting function extern C __declspec(dllexport) IDriver * __stdcall GetDriver()

  • 0

I have a dll with exporting function

extern "C" __declspec(dllexport) IDriver * __stdcall GetDriver() 

There is a programm which is written on Delphi. It can’t see the function GetDriver().
It’s double awful because I can not get and modify sources of this program.

What may be the reason of successful loading my dll (according log file) and failed call exporting function? Thank you.

Window 7 x64, Visual Studio 2010, C++ project for x86 target

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T11:46:36+00:00Added an answer on June 13, 2026 at 11:46 am

    The most likely explanation is that the function will have been exported with a decorated name. I’d expect it to have been exported with the name GetDriver@0. So you could import it like this:

    function GetDriver: IDriver; stdcall; external 'DllName.dll' name 'GetDriver@0';
    

    Use a tool like Dependency Walker to check the exact name used to export the function.

    If you cannot modify the Delphi code, then you’ll need to make your C++ DLL match. Do that by using a .def file which allows you control over the exported name.


    The other problem you will face is that Delphi’s ABI for return values differs from that used by most other tools on the Windows platform. Specifically a return value is semantically a var parameter. On the other hand, your C++ compiler will regard the return value as an out parameter. My question on Delphi WideString return values covers exactly this issue.

    Because of this, I’d expect the function declaration above to lead to access violations. Instead you should declare the return value to be a Pointer and cast it to an interface reference in your Delphi code. You’ll need to double check and make sure that the reference counting is handled appropriately.

    Again, if you cannot modify the Delphi code, you need to make the C++ code match. A Delphi interface return value is implemented as an additional var parameter following the other parameters. So, to make your C++ function match, declare it like this:

    void __stdcall GetDriver(IDriver* &retVal);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a dynamic library ( .dll ) written in C++ exporting a function
I have a .dll library which exports a function in the following format: _Java_folder1_folder2_folder3_JavaClassName_javamethodname@16
I have DLL, written in C++. There is structure in this DLL. typedef struct
I have DLL and application that will call some function in this dll. For
I'm pretty new in C#. I have Dll written on C++ by myself and
I have a dll in C# which returns a class object. DLL code: Person.cs:
I have a DLL which outpus data to a stream. But it adds a
I have a DLL which cause to an error when I run the application.
I have a DLL, written in XE2 that takes a PChar as a parameter
I'd like a simple example of exporting a function from a C++ Windows DLL.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.