Solved

Explicit DLL Linking

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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…
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.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

706 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

20 Experts available now in Live!

Get 1:1 Help Now