Solved

DLL Questions Series, Part 5

Posted on 2000-03-24
3
205 Views
Last Modified: 2010-04-02
This is the fifth part of the series.
The Overview can be found at:
http://www.experts-exchange.com/jsp/qShow.jsp?ta=cplusprog&qid=10294044 
The previous parts can be found at:
(1) http://www.experts-exchange.com/jsp/qShow.jsp?ta=cplusprog&qid=10294050 
(2) http://www.experts-exchange.com/jsp/qShow.jsp?ta=cplusprog&qid=10295050 
(3) http://www.experts-exchange.com/jsp/qShow.jsp?ta=java&qid=10296575 
(4) http://www.experts-exchange.com/jsp/qShow.jsp?ta=cplusprog&qid=10296931 

This question consists of two complementing subjects:

(a) What changes if instead of creating Win32 DLL project I create MFC DLL project? What support is added? Can I add it manually to a Win32 DLL project?

(b) Is there any difference between importing/exporting members of MFC-derived classes from/into a DLL and "simple" (not MFC-derived) ones?
0
Comment
Question by:Lescha
  • 2
3 Comments
 
LVL 2

Accepted Solution

by:
xLs earned 50 total points
ID: 2655803
a) using the MFC Dll project does only mean that you get the mfc library included and that you can take full use of it. But..

b) ofcourse if you define MFC specific methods that for instance returns a CString object, you may have to use MFC in your win32 project when importing your DLL.
However you can still write extern proc's that does use mfc in the code but not in the function definition (just like normal DLL without MFC).



good luck
/T. Rizos

0
 
LVL 1

Author Comment

by:Lescha
ID: 2656303
xLs,

you forgot one other subquestion:

what support (in other words, what lines of code) do I have to add to a non-MFC-supporting project in order to force it to support MFC?

Also: what happens if I try to link to DLL which supports MFC when my application doesn't support it?
0
 
LVL 2

Expert Comment

by:xLs
ID: 2656966
right, well an example of how to add mfc support is the simple Win32 Console wizzard (with mfc).

the problem is that mfc will need a CWinApp to handle the instance internally, and this will probably force you to modify some of your existing code (especially the main()).

what i would do if you have an non mfc existing project is to try wrap as much as possible of mfc methods that you will need in your dll so it is not visible in your DLL definition..

however, as meantioned you can still use all mfc support in your dll and use the dll in a non mfc win32 project.
this only if you dont have any declarations of MFC type in your header. so you can still use MFC in your code.
example:


if you have
extern CString GetPath();

you cannot use this in a non mfc project since CString won't be included.

instead go for
extern void GetPath(char* str,int bufsize);



if this is unclear i could setup a simple project with an mfc dll and a non mfc project using it?

cheers
/T. Rizos


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

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

919 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

14 Experts available now in Live!

Get 1:1 Help Now