Home:ALL Converter>Does each library that statically links the C runtime have a different version of the runtime?

Does each library that statically links the C runtime have a different version of the runtime?

Ask Time:2021-05-01T08:41:27         Author:Zebrafish

Json Formatter

This may seem like the most basic question but I haven't really dealt with this sort of stuff, so I was hoping someone could give an explanation. Let's just say:

  1. I have Library 1, and I compile it as a static library .lib, and in the compiler options I link the C runtime statically (on Visual Studio /MT flag).

  2. I have Library 2 and I compile it in exactly the same way as library 1.

Then I have my program which is an .exe program/application, and in my application code I link the C runtime statically. Does it mean that my application's instructions on how to treat an std::vector (size, debug details etc.) or a call to 'operator new' or 'malloc' is potentially different from the instructions in the other two libraries? And also are the instructions in each library different from the other library?

Assuming I build both libraries and my .exe application in a consistent way, ie., all debug or release mode, are there still potential differences between the runtime classes and functions between the two libraries and my application depending on what runtime was statically linked when it was compiled?

If the answer if yes, and if dynamically linking the runtime for each library is the best solution what's the way to ensure that each library links the same version of the dynamic runtime library?

Author:Zebrafish,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/67341937/does-each-library-that-statically-links-the-c-runtime-have-a-different-version-o
yy