Solved

Explicit DLL Linking

Posted on 1998-02-13
3
233 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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

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.
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.
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.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

803 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