Link to home
Start Free TrialLog in
Avatar of Surfer
Surfer

asked on

explicitly load a MFC extension DLL that exports a CObject derived class?

Is it possible to explicitly load a MFC extension DLL that exports a CObject derived class?  The calling exe is an MFC app.  I have no problem doing this using a .lib file linking implicitly.  Can you please supply a small code sample.  
Avatar of MRNMurthy
MRNMurthy
Flag of India image

Hi,

I will try to send the code.

From

MRN Murthy
Avatar of Surfer
Surfer

ASKER

That would be great!  I look forward to your email.
Avatar of Surfer

ASKER

That would be great!  I look forward to your email.
Avatar of Surfer

ASKER

That would be great!  I look forward to your email.
Surfer,

What is that you can not do? Do you need to know how to load a dl explicitly or do you need to know how to export a MFC derived class in a dll?  If you explain a bit more we can help you.

My 2 cents...
Avatar of Surfer

ASKER

The main part of my question is:

I have a class
AClass : poblic CObject
{
...
}
I want to export my class from my DLL to the calling app.  If I use implicit linking I know what to do.  However, if I link explicit, what is the best way to import this class into my exe?  I know who to use exlictt linking with functions, but how do I do it with a classes and is it safe?

Thanks
Surfer,

To export an entire class from a dll you must prefix the class with AFX_EXT_CLASS like so...
class AFX_EXT_CLASS AClass : public CObject
{
...
}


and of course your dll must be an MFC extension dll since you are subclassing CObject

My 2 cents...
Avatar of Surfer

ASKER

How do I use explicit linking to call this class from my exe?
Avatar of Surfer

ASKER

How do I use explicit linking to call this class from my exe?
Avatar of Surfer

ASKER

How do I use explicit linking to call this class from my exe?
Avatar of Surfer

ASKER

How do I use explicit linking to call this class from my exe?
ASKER CERTIFIED SOLUTION
Avatar of cypherljk
cypherljk

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial