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

  • Home
  • SEARCH
  • 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 6216709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:17:50+00:00 2026-05-24T07:17:50+00:00

I have a (big and complex) C++ program with its own classes and methods.(obviously)

  • 0

I have a (big and complex) C++ program with its own classes and methods.(obviously)

I would like to load at runtime a dll. From the main program i want to call a function inside the dll passing a class instance , and this function will use the method of this class.

In pseudo code

Main program:

 class MyClass{
       myattr1();
       myattr2();
       mymethod1();
       mymethod2();
 }
 
 void main(){
      MyClass* object = &(new MyClass())
      handle_of_the_dll = *some function that load the dll*
      dllfunc = getfunc(handle_of_the_dll, "interesting_function")
      dllfunc(object)
      [...etc...]

and the dll

#ifdef __cplusplus
extern C {
#endif
#ifdef BUILD_DLL
#define EXPORT __declspec(dllexport)
#else
#define EXPORT __declspec(dllimport)
#endif

#include all the needed headers from main program, where the class is defined

EXPORT void  interesting_functionn(MyClass object){
  object.mymethod1();
}
#ifdef __cplusplus
}
#endif

Is this valid/doable/right?

EDIT:

i know that this would be a poor design for a general program, but this method is intended to give the users the ability to use their custom dll that can access the api of the main program. Something like Cpython modules

  • 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-05-24T07:17:51+00:00Added an answer on May 24, 2026 at 7:17 am

    It is valid and doable. Generate a sample DLL in visual C++ and the code will have all the bases covered. Replace the static linking in the client with LoadLibrary and GetProcAdress.

    Name mangling could be an issue, DependencyWalker will help you there.

    Keep a low profile with emory management. For example, if you use a memory manager on one side but not on the other, your begging for trouble.

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

Sidebar

Related Questions

I have big trouble with file uploads with php. My own tests are successful
How would you maintain the legacy applications that: Has no unit tests have big
Let's assume you have a big complex index page, that shows news articles and
Some complex subversion merges are coming up in my project: big branches that have
I have a PHP web app that generates a somewhat complex report from our
I have a recursive method call. When any exception is thrown, I would like
I have a situation where I am attempting to port some big, complex python
I have a complex regex, and I'd like to match it with the contents
I have a complex query, when I execute it, I get a big table
I have a quite complex, even though not really big, array, with many levels

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.