Solved

Explicit DLL Linking

Posted on 1998-02-13
3
225 Views
Last Modified: 2013-11-20
I need some help using an exported class from a regular DLL statically linked with MFC.  Basically, I want to avoid distributing .lib files, or requiring the use of IMPLIB32.  I know that I need to use LoadLibrary("MYDLL.DLL"), but then how to I access a class that was exported in the DLL with the AFX_EXT_CLASS macro?  I can find lots of info on using GetProcAddress to access exported c++ functions, but no info on how to access exported classes from the DLL.

Thanks in advance
0
Comment
Question by:headley
3 Comments
 
LVL 32

Expert Comment

by:jhance
ID: 1316173
It's not clear to me what you are try to do with your DLL.  You mentioned distributing .lib files.  If you are making a DLL that will be distributed to others for their use in RUNNING your application, then there is no need to distribute a .lib file.  If, however, you are distributing a DLL for other DEVELOPERS to use in building their applications, then you must distribute a .lib file so that they can link their application to your DLL.  If you would explain more clearly and in greater detail what you are trying to do, I think it would help in providing an answer.
0
 
LVL 7

Accepted Solution

by:
galkin earned 100 total points
ID: 1316174
First of all it is impossible to export class from regular DLL, you can do this from extension DLL only. Moreover it is very difficult if possible at all to link DLL exporting class dinamically. What I suggest you doing is turn your DLL into OLE server. Now you class can implement any custom interface which methods are functions you want to export from your class. Now no lib file is needed and you can create your class instance from any EXE or other DLL. Moreover there is runtime binding so change in private data doesn't affect interface methods.
0
 

Author Comment

by:headley
ID: 1316175
Thanks for the help.  It was my understanding that an extension DLL required other developers to use MFC... and would not allow others to use my DLL in another environment, say Visual Basic (yuck!).  Anyway, the comments helped for the most part, and I'll just continue along those lines.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Strange date stored 22 106
Macro to save highlighted rows as a separate file 5 41
Named range not carried over 10 62
lucky13 challenge 11 122
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

910 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now