Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

GetProcAddress() of DLL class member functions?

Posted on 1998-03-20
4
Medium Priority
?
2,228 Views
Last Modified: 2013-11-20
I am having trouble with runtime linked DLL's. The problem is that I can called global functions inside the DLL project, but if I make a function inside the WinApp class (for example) it can't seem to get the procedure address?
Are there any examples around which show runtime linked member functions of classes? (not just c functions).
0
Comment
Question by:jpronk
  • 2
  • 2
4 Comments
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 200 total points
ID: 1317119
While you can do that, the work involved is much more complicated. The biggest reason is that the member functions require a hidden this parameter which indicates the object the function is associated with. You don't have this in the declaration because it is generated by the compiler behind the scene.

Typically, if you have a member function you want to expose, you expose the entire class and not just one member function.


0
 

Author Comment

by:jpronk
ID: 1317120
So how do you get the address of the object then at runtime?
Currently I have by-passed the problem by interfacing via global functions, which seems to  work pretty good. Except I am not sure its the best way to go about things.
The DLL's are actually plugins to this software I am building.

thanks for your help
0
 
LVL 15

Expert Comment

by:Tommy Hui
ID: 1317121
You provide a global exported function who returns a pointer to the object. For example,

  _declspec(dllexport) IFoo* CreateFoo()
  {
    IFoo* foo = new IFoo;
    return foo;
  }

  _declspec(dllexport) BOOL CleanupFoo(IFoo* foo)
  {
    delete foo;
    return TRUE;
  }

0
 

Author Comment

by:jpronk
ID: 1317122
Oh ok, yeah I think I did that a while back. Is there much of an overhead on calling a member function rather than a global funtion (is one faster than the other?).
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question