Question

  1. Is there a difference between a standard library and a runtime library?

  2. Is the C standard library in windows the same as Windows C RT library?

  3. Is it implemented in msvcrt.dll? And if not, where so?

  4. How and when that library is linked to an executable? Is there a .lib file for relative addresses?

Sorry if I mixed some things...

Was it helpful?

Solution

On windows, there are 3 models in debug and non-debug i.e. 6 all together

1) Single Threaded 2) Multithreaded using MSVCRT.DLL 3) Multithreaded not using MSVCRT.dll

By default, windows chooses option 2. This is the only one that uses the runtime library. With options 1 and 3, everything in linked into the executable. You can take that executable to any windows machine from 95 upwards and it should work. The difference is that case 2 files are a lot smaller that case 1 or 3. Important if you are trying to squeeze files on to a CD or a floppy. Also case 2 is tied to a particular version of MSVCRT. eg if you build it on VC6 and try to run the executable on Windows 7, it won't work unless you have the VC6 msvcrt on the W7 machine.

Question 1: difference between standard and runtime. Cases 1&3, no. Case 2: yes. The .lib is just a jump table. The .dll contains the actual code

Question 2: Isn't that the same question as Question 1?

Question 3: msvcrt = Microsoft Visual C Run Time. This is the runtime library

Question 4: At compile time, HOW using the linker, WHEN when linking. At run time in cases 1&3 it is ready to go. In case 2, HOW - it is already done. WHEN - there is an additional step where the jump table code is linked with the DLL before it runs. This extra step makes executables for case 2 slower to load up (not that anyone would notice it with the superfast machines we have nowadays).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top