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 8103037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:24:28+00:00 2026-06-05T23:24:28+00:00

I have a C++ DLL that I wrote that has a single exposed function,

  • 0

I have a C++ DLL that I wrote that has a single exposed function, that takes a function pointer (callback function) as a parameter.

#define DllExport   extern "C" __declspec( dllexport )

DllExport bool RegisterCallbackGetProperty( bool (*GetProperty)( UINT object_type, UINT object_instnace, UINT property_identifer, UINT device_identifier, float * value ) ) {
    // Do something. 
}

I want to be able to call this exposed C++ DLL function from within a Delphi application and register the callback function to be used at a future date. But I am unsure of how to make a function pointer in Delphi that will work with the exposed C++ DLL function.

I have the Delphi application calling a simple exposed c++ DLL functions from the help I got in this question.

I am building the C++ DLL and I can change its parameters if needed.

My questions are:

  • How to I create a function pointer in Delphi
  • How to I correctly call the exposed C++ DLL function from within a Delphi application so that the C++ DLL function can use the function pointer.
  • 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-05T23:24:31+00:00Added an answer on June 5, 2026 at 11:24 pm

    Declare a function pointer in Delphi by declaring a function type. For example, the function type for your callback could be defined like this:

    type
      TGetProperty = function(object_type, object_instnace, property_identifier, device_identifier: UInt; value: PSingle): Boolean; cdecl;
    

    Note the calling convention is cdecl because your C++ code specified no calling convention, and cdecl is the usual default calling convention for C++ compilers.

    Then you can use that type to define the DLL function:

    function RegisterCallbackGetProperty(GetProperty: TGetProperty): Boolean; cdecl; external 'dllname';
    

    Replace 'dllname' with the name of your DLL.

    To call the DLL function, you should first have a Delphi function with a signature that matches the callback type. For example:

    function Callback(object_type, object_instnace, property_identifier, device_identifier: UInt; value: PSingle): Boolean cdecl;
    begin
      Result := False;
    end;
    

    Then you can call the DLL function and pass the callback just as you would any other variable:

    RegisterCallbackGetProperty(Callback);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a dll that exports extern C __declspec(dllexport) int __stdcall Foo( void );
In my situation, I have a C# DLL I wrote myself that has been
I have DLL and application that will call some function in this dll. For
I have a VB6 ActiveX DLL that has run fine on all our machines
I have a dll written by someone else and that has many flaws. Let's
It has been about a year since I wrote any .dll plugins that use
I have an API (a DLL) which has various methods that return objects /
I have an unmanaged dll that contains a function to read a data from
We have a certain database that has some employee information, and I just wrote
I have application that has to write to console. Also I call function from

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.