The following text is available as RESDLL.ZIP in the MSMFC library on CompuServe (applies to MSVC20):
How To Manage An MFC Project Storing Its Resources Into A Resource-Only DLL
Software localization is much easier when your project stores its resources in a resource-only DLL. There area also many situations where storing the project's resources in a DLL can be a good idea.
However, if this project is an MFC project, doing so will generate a major drawback: you will not benefit from the Class Wizard capabilities any longer because the resources will be managed in a separate project.
However, there's a trick that you can use to develop your project as if it were a standard project while being able to quickly switch to the resource-only DLL model. Here's how to proceed:
METHOD 1 :
- Select Project|Settings from the man menu.
- Click on the Link tab.
- Select General from the category combobox.
- In the Object/Library Modules field, remove all references to any .LIB file (they are useless) and add /NOENTRY. This option should then appear in the Common Options display area.
- Click OK and compile. You now have a DLL containing only the resources for your project.
BEWARE: When switching from one model to another, you must either Rebuild All or touch TEST.CPP. Otherwise, you'll have problems.
Now, you are able to modify your resources and to use Class Wizard when you work with TEST.MAK. To build the resource-only DLL version of the project, just switch to TEST_RES.MAK after recompiling RESDLL (RESDLL.MAK) if changes have been made to the resources.
It's that easy!
METHOD 2 :
Now TEST and RESDLL will work together through the ClassWizard. The resources defined in RESDLL.RC will not be added to TEST.EXE. This method is simpler but doesn't allow you to test your program in both cases (resources in the DLL or resources linked to the .EXE file). I prefer the latter when developing because I do not have to bother about orphaned DLLs when a GPF occurs (although this is less a problem under NT).
Don't forget to recompile the DLL before testing your program each time you modify the resources. A batch file calling NMAKE installed in the Tools menu will certainly be faster than switching from project to project. Using the "New Target" facility won't help in that case.
It would be nice if VC++ had the same capability as Borland C++: a project can contain multiple independent targets. So, the developer is able to manage DLL and EXE creation from within the same project.
Patick Philippot, CIS Email, 8/3/95