Which VC++ redistributable package to choose (x86 or x64)?

Matthias Bäßler picture Matthias Bäßler · Jan 30, 2012 · Viewed 31.9k times · Source

Is the package type (x86 or x64) dependent on my application type or on the OS type it is installed on?

I.e., if I develop a 32-bit application do I need to

  • deploy the x86 package only or
  • deploy both packages and install x86 on 32-bit windows and x64 on 64-bit windows?

The answer to this question 32-bit VC++ redistributable on 64 bit OS? suggests that it's only the x86 package, so it would be dependent on my application but it doesn't give any explanation/links. The MS download sites are also not specific on this.

Answer

Ben Voigt picture Ben Voigt · Feb 1, 2012

When you compile, all use of the standard library creates references that must be resolved at link time. The linker bakes in the import library for the matching runtime DLL(s), which must be matched completely at load time. That means matching the compiler version, service pack, and bitness.

Also remember that a 32-bit process cannot load 64-bit DLLs. Because the 64-bit redist only contains 64-bit DLLs, it is of no help when loading a 32-bit executable.