Mr. Boy
Mr. Boy

Reputation: 63710

Creating a shared MFC Dialog: Regular DLL or MFC extension DLL

When creating a MFC DLL project in VC++ 2005, you get a screen "application settings" with a choice of Regular DLL with static/dynamic MFC, or an MFC Extension DLL.

We want a DLL that contains a few common dialogs, so we can use them in other projects e.g:

CGetNameDlg *dlg = new CGetNameDlg();
dlg->doModal();
string name = dlg->getName();
delete dlg;

We're not sure whether this requires an extension DLL... if those are specifically for adding new controls to enhance MFC itself, or if we just do a regular DLL project linking to MFC dynamically, like we would if it was an EXE project.

Upvotes: 0

Views: 2311

Answers (2)

Darren Ford
Darren Ford

Reputation: 896

Personally, I'd create a regular DLL. I find that a regular DLL gives a much greater separation of code than an extension DLL, with the added complexity of having the use the AFX_MANAGE_STATE() macro at the entry point of each call into the DLL.

And if you design your code well (eg. pass only native objects to/from the DLL), you can use the same DLL in a plain win32 app/C# app/VB app with little trouble.

Upvotes: 1

ChrisBD
ChrisBD

Reputation: 9209

You'll be fine to do it as a regular DLL rather than an MFC extension and would be my preferred choice.

Upvotes: 1

Related Questions