Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

GetProcAddress() of DLL class member functions?

Posted on 1998-03-20
4
Medium Priority
?
2,182 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
In this post we will learn different types of Android Layout and some basics of an Android App.
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 tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

722 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