I started learning C ++, I had questions about the runtime libraries. I use vs2012

  1. Why do we need these libraries and what functions are contained in them?
  2. Is it possible to build a project without them?
  3. Is it possible to tell the linker to link the file with msvcrt and not with mscr110?

Closed due to the fact that the question is too common for the participants Vlad from Moscow , αλεχολυτ , user194374, Alex , Duck Learns to Hide 1 December '16 at 9:33 .

Please correct the question so that it describes the specific problem with sufficient detail to determine the appropriate answer. Do not ask a few questions at once. See “How to ask a good question?” For clarification. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • Clean C ++ using, or some C ++ \ CLI? - isnullxbh
  • With no cli .net - Ildar
  • The first question will be answered by this article - isnullxbh
  • By the way, what prompted you to ask this question? Any mistakes? Like someone method already defined in .. ? - isnullxbh
  • No. I just want to understand how the code works in the OS when it is launched - Ildar

1 answer 1

  1. Libraries are needed for the program. They contain various functions that you can use in your programs. In standard libraries supplied with compilers, the code of the functions of the standard library , together with the support code.
  2. Theoretically possible. Just what will be able to such a code? It will not be possible to use any input, output, and even command line parameters or operating system functions (how do you refer to them?) The same Hello will pull the whole library with you - you need not just to output the word, but to open the file stream, process etc etc errors

To the second point - the memories of youth, as in the days of Borland C ++ 3.1, I tried to castrate the startup code, so I had an empty program for a hundred bytes, and added my micro-library — I / O via DOS / BIOS, my memory micro-manager, working with files through DOS. Programs came out really tiny size, as written in assembler. What they, in fact, were. But you had to write everything yourself :)

  • Please tell me if I understand this line correctly: "It sets up the module entry point, such as preparing argc / argv for console applications". The document itself . Those. zayuzal main - get ready for the runtime libraries to be locked? - isnullxbh
  • Yes of course. This is the code that parses the command line (creates parameters for main ), opens standard files, initializes the memory manager ... - in general, prepares everything for main work. I started in my experiment - I tried to castrate the startup code - from him. Formally, by the way, it may not be a library for libraries - this is how the developers jumped in ... - Harry
  • Understood thanks ! - isnullxbh