5

Using Visual Studio, I have built an C++ application running in 32bit. It will be deployed both to 32-bit and 64-bit Windows servers. It won't be run in 64-bit mode (but rather under WoW).

Should I include both the 32-bit and 64-bit Visual C++ redistributable, and install 32bit on 32bit Windows and 64bit on 64 bit Windows, or is it enough to just install the 32bit redistributable?

Piotr Dobrogost
  • 41,292
  • 40
  • 236
  • 366
martinnitram
  • 53
  • 1
  • 1
  • 3

5 Answers5

5

It is enough to install the 32bit redistributable.

Karel Petranek
  • 15,005
  • 4
  • 44
  • 68
3

EDIT: I commented below on a misleading answer, but the answer is you only need the 32-bit redistributables, as Karel Petranek answered first.

This is not an answer. It should only be a comment, but since I don't have the required reputation for that...:

I just wanted to warn people against Ruel's provided information. No, the 64-bit Visual C++ redistributable packages don't also include the 32-bit DLLs.

I have even tested that (his) theory. I tried to run an application that requires Visual C++ 2010 32-bit redistributables and it prompted me that it needs that. I then installed the 64-bit one, and it still prompted it needed the 32 bit version of Visual C++ 2010. After installing the 32 bit one, it worked.

Why people come up with theories and provide them as answers beats me. Or maybe he was also "encouraged" by the reputation system to give not only superfluous, but also false information. Or maybe he just confused C++ with DirectX 9 redistributables (that one does install both 32-bit and 64-bit DLLs).

bitoolean
  • 131
  • 1
  • 7
1

Both are Microsoft products, but don't let that fool you.

Your C++ application creates a 32 bits EXE, linking to 32 bits DLLs. As it happens, one or two of those DLLs are Microsoft CRT DLLs, but the OS still uses the same rules. Therefore, you don't need the 64 bits DLLs.

MSalters
  • 173,980
  • 10
  • 155
  • 350
1

Compile it using /MT option and VC++ runtime library will be compiled into your exe, so you don't have to worry about distributing it.

Project > Properties > Configuration Properties > C/C++ > Code Generation > Runtime Library > Multi-threaded (/MT).

Czarek Tomczak
  • 20,079
  • 5
  • 49
  • 56
  • 4
    This is not really a great idea, because any bug fixes (including security issues) in VC++ runtime by MS will not make into your product, as you would have a static exe. Embedding the runtime should be clearly weighed in terms of pros and cons. – Jaywalker Nov 04 '13 at 12:41
  • @Jaywalker Besides, it will also take up more of the memory at run time, I think? When multiple processes that use the same runtime are running at the same time, they will take advantage of the system loading the shared library only once, right? If it's statically compiled, we are preventing the system from doing that. Also, more space on the drive would be occupied. An advantage of static compilation is more portability. – bitoolean Jul 02 '19 at 15:59
-2

The 64-bit Visual C++ redistributable package includes both 32-bit Visual C++ redistributable and 64-bit Visual C++ redistributable.

Ruel
  • 15,438
  • 7
  • 38
  • 49
  • 1
    @bitoolean states that this information isn't right, so 64 bit redistributable package might not include the 32 bit versions (I didn't test it myself). – Micka Feb 10 '16 at 14:14
  • Indeed. I tested because when inspecting the contents of the installation package for the redistributables, it seemed they didn't include both versions of the libraries. See [my answer](https://stackoverflow.com/a/29761893/1810094). Please dismiss Ruel's answer until argument to the contrary. – bitoolean Jul 02 '19 at 16:08