Redistributing an application and binding it to specific Libraries

Source: Internet
Author: User
Document directory
  •  

Visual Studio 2008

Updated: July 2008

The libraries for Visual Studio often are updated after a release. for example, this can occur when you install a service pack. applications that are designed with the updated libraries might depend on some changes that were made in the latest releases. the application might behave in unexpected ways if you transfer it to a user who has not installed the same libraries. to protect against this unexpected behavior, you can bind your application to a specific version of the libraries.

Default binding behavior

This section describes the default behavior of applications compiled with Visual C ++ 2008 and later releases. when you compile an application, it is bound to the original release version of libraries available. this is true even if you have a later release installed on your computer. for example, if you have visual C ++ 2008 SP1 installed on your computer, any applications that you compile on this computer will still depend on the original release version of Visual C ++ 2008.

This behavior is of no consequence if you deploy your application by installing in a central location. by using this distribution scheme, the latest libraries will always be available to the end user. however, if you use a local deployment method, such as with private assemblies as described in the topic how to: deploy using xcopy, this behavior is important.

The default binding behavior enables you to recompile your program after you obtain a new release, and to distribute the new executable. the end users who already installed the necessary libraries will need only the new executable; you will not have to package and reinstall the latest libraries.

Note:

If your application depends on functionality introduced in the latest release, you must distribute and reinstall the new libraries, or else the application will not run.

How to bind to specific versions

If you want to force your application to require that the latest libraries be installed on your computer, use one or more of the following lines of code:

Copy

#define _BIND_TO_CURRENT_CRT_VERSION 1#define _BIND_TO_CURRENT_ATL_VERSION 1#define _BIND_TO_CURRENT_MFC_VERSION 1#define _BIND_TO_CURRENT_OPENMP_VERSION 1

Use the following line of code to bind your application to the current version of all your visual C ++ libraries. This is a union of all the previous lines of code.

Copy

#define _BIND_TO_CURRENT_VCLIBS_VERSION 1;

Note:

We recommend that you define these macros at the command-line level. if you prefer to include the definitions in code, you must put them at the very start of every compilation unit-such as the first lines in stdafx. h.

When you bind your application to a set of libraries, it will not run on a computer that has an earlier version of those libraries. if you bind your application to a specific minimum version, we recommend that you ship your application together with the required version of the libraries.

See also

Concepts

Redistributing visual c ++ files

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.