Solved

Explicit DLL Linking

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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 video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

734 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