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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T12:31:08+00:00 2026-05-16T12:31:08+00:00

I’m relatively new to DLL importing and function binding. Let’s say I have a

  • 0

I’m relatively new to DLL importing and function binding. Let’s say I have a C++ project which is a GUI library written fully in OOP aiming to be used in games.

My game project however is written in Delphi. I now want to bind Delphi functions to the ones in the DLL.

I would know how to do this with simple functions, without classes like in C – but what about OOP?

So in short: Can I bind Delphi functions to the ones in a DLL which consists of compiled C++ classes?

Aren’t classes lost during the compilation process?

  • 1 1 Answer
  • 3 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-05-16T12:31:08+00:00Added an answer on May 16, 2026 at 12:31 pm

    I’m still coming to grips with many aspects of C++, but hopefully the following makes some kind of sense.

    There are some aspects of C++ that I don’t think will translate well via a purely DLL import based mechanism. For example I don’t think that you’ll be able to support polymorphism or method overloading.

    However, that doesn’t mean that you can’t make use of classes. I think that the easiest way to convey how this might work is a toy example.

    //Start with a class definition
    class foo
    {
      int bar = 0;
      int getBar();
    };
    
    // Now create a C API that you can access from Delphi
    extern "C" {
    
    void *createFoo()
    {
      return new foo();
    }
    
    int getBar(void *fooInstance)
    {
      foo *fooObj = (foo*)fooInstance;
      return fooObj->getBar();
    }
    
    } // end of extern "C"
    

    Then export the extern "C" functions to delphi and use them.

    I don’t have a compiler handy to test that, and there may be mistakes, however hopefully there is enough there to convey the concept. If there are any gross errors, please let me know and I’ll fix it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a text area in my form which accepts all possible characters from
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.

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.