HOWTO: Build an MFC add-in which needs no runtime DLLs

Reference: Q0049

Article last modified on 28-May-2008


The information in this article applies to:

  • XLL+ for Visual Studio 2005 - 5.0

How to build an MFC add-in which needs no runtime DLLs

Issue

I have built an XLL using MFC libraries and Visual Studio 2005. If I deliver it to a user's machine, it requires the MFC runtime DLLs. These have to be installed by an administrator, which is not always permitted or convenient. How can I produce an XLL which uses MFC but does not need run-time libraries?

Summary

  1. Download the "XLL+ 5.0 MFC Minimum-dependency libraries for VS 2005", and copy them to your XllPlus\Lib directory.
  2. Change the settings of your XLL+ project as detailed below.
  3. Check that your XLL has no other dependencies.

Download

Note that the MFC minimum-dependency libraries are only available for licensed users. To download them from our web-site, you will need to have registered a license for XLL+ for VS2005.

The download can be found on our Downloads page. The file to download is named "MFC Minimum-dependency libraries for XLL+ 5/VS2005".

Settings

Open the project properties window for your project, and change the following settings. Note that some of the settings vary for the Debug and Release builds.

  1. In the General tab, set Use of MFC to "Use MFC in a Static Library".

  2. In the C/C++ Preprocessor tab, select Preprocessor Definitions and add XLL_NO_LIBS.

  3. In the C/C++ Code Generation tab, set Runtime Library to "Multi-threaded Debug (/MTd)" (for Debug builds) or "Multi-threaded (/MT)" (for Release builds).

  4. In the Linker Input tab, select Additional Dependencies and add either xlllibdi.lib (for Debug builds) or xlllibri.lib (for Release builds).

Deployment

Before you deploy your XLL, use the Dependency Walker to inspect it for any other dependencies. This tool is delivered as depends.exe, and is part of Visual Studio and can be found in Common7\Tools\Bin under the Visual Studio 2005 installation folder.