Hello, I noticed that when transferring a program written in MVS C ++ to another computer where MVS is not installed, it is required to additionally include some dlls from MVS with it, and even for a regular hellovord, two libraries MSVCP120.dll and MSVCR120.dll are required. Actually the question is: is it possible to see which standard dlls will be used when creating a project in VS, so that you don’t guess? And theoretically, why do we need these dll libraries for elementary console programs? (In Qt, for example, you have to drag a whole bunch of dll along with the program). I would be very grateful for the detailed response.

  • These libraries are a payment for the fact that the binary will be small (which is usually put in opposition to Delphi). But if in 6 studios it worked, then in the next MC did everything that it was not so easy. They also made Redistributing Visual C ++ Files , which installs the necessary libraries. - KoVadim
  • That is, for earlier to find out what dll will be used for a project is impossible? In Qt Creator, for example, there the dll list can always be different, as I noticed. - Vestail
  • You can find out if you know. That is, if you look at the include list, then the dll list can be found. Another thing is that so simply put these dll next to the binary does not work (at least in my version of the studio 2010). - KoVadim

2 answers 2

You can view all dependencies using the dependencywalker tool. The libraries you are talking about are the so-called startup code (C runtime library). Only here I do not know both or one of them. I'm not a very big spec in question, but I'll try to explain in my own words. These libraries contain implementations of some of the possibilities provided by the language, for example, memory allocation and accounting for the new operator. Therefore, even the simplest console program must either have this code inside of itself (static link) or will be distributed with these libraries (dynamic link). This is configured in the project properties:

C++ -> Code Generation -> Runtime library 

    Specify in the project settings a statically linked runtime library. EXE will increase in size, but will not bind to the dll.