HOW TO: How do I build an add-in with "Multi-threaded DLL" settings (/MD)?

Reference: Q0026

Article last modified on 20-Apr-2006


The information in this article applies to:

  • XLL+ for Visual Studio .NET - 4.3.1
  • XLL+ for Visual Studio 6 - 4.3.1

HOW TO: How do I build an add-in with "Multi-threaded DLL" settings (/MD)?

Question

I am building an XLL that links to another DLL built with the "Multi-threaded DLL" runtime library (/MD compiler option). How can I ensure that my XLL and the DLL share a single DLL copy of the Microsoft runtime libraries?

Answer

You need to download the "Multi-threaded DLL" XLL+ run-time libraries from our support site and build your XLL against these.

Please note that these libraries are only available for owners of licensed copies of XLL+, and not for the trial version. In addition, they are only available for XLL+ version 4.3, and not for earlier versions.

You will also need to make some changes to your project's compiler and linker settings, as described below.

Finally, you should ensure that when you deploy your XLL, all the necessary DLLs, including the MS runtime DLL, are available on the target machine.

Download the run-time libraries

Visit our support site at http://www.planatechsolutions.com/support and log in. If you have not already registered your XLL+ license, please do so at this time. You will need to do so in order to download the libraries.

Go to the Downloads page. Depending on your XLL+ license you should download one of the following files.

License License starts with Download name Downloaded file name
XLL+ 4.3 for Visual Studio 6 PXLP42S Multi-threaded DLL build for XLL+ 4.3 (VS 6) xlps_md_4_3_1.zip
XLL+ 4.3 for Visual Studio .NET PXLP42N Multi-threaded DLL build for XLL+ 4.3 (VS.NET) xlpn_md_4_3_1.zip
XLL+ 4.3 for Visual Studio 6 and Visual Studio .NET PXLP42U Multi-threaded DLL build for XLL+ 4.3 (VS 6+.NET) xlpu_md_4_3_1.zip

Once you have downloaded and saved the zipped file, you will receive an email supplying the password for the zipped file.

Unzip the file into the XLL+ installation directory, typically C:\Program Files\Planatech\XllPlus. New files will be added to some or all of the existing sub-directories listed below.

Sub-directory File Description
Lib xlllibsmr.lib Multi-threaded DLL XLL+ runtime libraries for Visual Studio 6 (Release configuration)
Lib xlllibsmd.lib Multi-threaded DLL XLL+ runtime libraries for Visual Studio 6 (Debug configuration)
Lib7 xlllibsmr.lib Multi-threaded DLL XLL+ runtime libraries for Visual Studio .NET 2002 (Release configuration)
Lib7 xlllibsmd.lib Multi-threaded DLL XLL+ runtime libraries for Visual Studio .NET 2002 (Debug configuration)
Lib71 xlllibsmr.lib Multi-threaded DLL XLL+ runtime libraries for Visual Studio .NET 2003 (Release configuration)
Lib71 xlllibsmd.lib Multi-threaded DLL XLL+ runtime libraries for Visual Studio .NET 2003 (Debug configuration)

Changing your project settings (Visual Studio 6)

  1. Open the project settings dialog and select the C/C++ tab. Select the category Code Generation For the Win32 Release configuration, set Use run-time library to Multithreaded DLL.
  2. In the Win32 Debug configuration, set Runtime library to Debug Multithreaded DLL.
  3. Still on the C/C++ tab, select the category Proprocessor. Add the following setting to the Preprocessor Definitions field: XLL_NO_LIBS. Do this for the Release build and for the Debug build; in each case, the Preprocessor Definitions should now end with: ,XLL_LIB_STL,XLL_NO_LIBS.
  4. Move to the Link tab, and select category Input. For the Release configuration, in the field Object/library modules, insert the library xlllibsmr.lib at the beginning of the list. (Ensure that it is followed by a space to separate it from other libraries.)
  5. For the Release configuration, in the field Object/library modules, insert the library xlllibsmd.lib at the beginning of the list. (Ensure that it is followed by a space to separate it from other libraries.)

Changing your project settings (Visual Studio .NET)

  1. Open the project settings dialog and select the node Configuration Settings - C/C++ - Code Generation. For the Release configuration, set Runtime library to Multi-threaded DLL (/MD).
  2. In the Debug configuration, set Runtime library to Multi-threaded Debug DLL (/MDd).
  3. Select the node Configuration Settings - C/C++ - Preprocessor. Add the following setting to the Preprocessor Definitions field: XLL_NO_LIBS. Do this for the Release build and for the Debug build; in each case, the Preprocessor Definitions should now end with: ;XLL_LIB_STL;XLL_NO_LIBS.
  4. Select the node Configuration Settings - Linker - Input. For the Release configuration, in the field Additional Dependencies, add the library xlllibsmr.lib.
  5. For the Debug configuration, in the field Additional Dependencies, add the library xlllibsmd.lib.

Deployment

When you deploy the XLL built in the release configuration, the following MS run-time DLLs should be present on target machines, and should reside in a directory on the PATH.

Compiler Required files
Visual Studio 6 MSVCP60.DLL
MSVCRT.DLL
Visual Studio .NET 2002 MSVCP70.DLL
MSVCR70.DLL
Visual Studio .NET 2003 MSVCP71.DLL
MSVCR71.DLL