Solved

Creating a DLL that uses MFC

Posted on 2006-06-15
4
214 Views
Last Modified: 2010-04-01
I have never created a DLL before.  I am using MSVC++ 6.0.  I would like to create a new DLL that uses MFC.  What is the best way to do this.  I have tried creating a Win32 DDL and it is not obvious to me how I enable MFC support.
0
Comment
Question by:jribble
[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
4 Comments
 
LVL 12

Accepted Solution

by:
rajeev_devin earned 500 total points
ID: 16912578
Goto File > New > Projects > Select MFC AppWizard (dll).
And then give the project a name and click OK.
You MFC DLL base is ready.

good luck !
0
 
LVL 12

Assisted Solution

by:rajeev_devin
rajeev_devin earned 500 total points
ID: 16912604
If you just want to enable MFC in your Win32 DLL.
Then goto Project > Settings > General > I Microsoft Foundation Classes combo select
Use MFC in a Static Libray, or
Use MFC in a Shared Libray.

Your project is now MFC compatible.
0
 

Author Comment

by:jribble
ID: 16914595
Ok, that was easy enough.  Maybe its not fair to ask another question, but how do I add a class/function and make it available to my application?
0
 
LVL 12

Expert Comment

by:rajeev_devin
ID: 16917386
Put the declaration of the function or class in a header file.
Put the definition of the function or class in a source file.

In your application you need to include the header file.
#include "mydll.h"

In addition you will get a .lib file along with the .dll file.
In your linked settings add this .lib file to avoid linking error.

thats it.
good luck !
0

Featured Post

Industry Leaders: 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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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 clear a vector as well as how to detect empty vectors in C++.

735 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