How Linux CRunTime Library Handles Compared to Microsoft

I had a lot of conceptual issues with Microsoft CRT. For any project, you must compile all the necessary libraries to reference the same version of CRT.

The first problem is that your project is statically linked to CRT (/ MT). Then all dependent libraries must also link their own CRT statically. Therefore, each library has its own version - for example, - malloc (). If you compiled one of the libraries last year on system A, this version of CRT may be different from the one you use on another system B with Service Pack 3+. Therefore, if you free objects allocated by the library, you may run into problems.

Thus, dynamically linked CRT is the path (/ MD). With dll, all libraries will receive the current CRT implementation in the system. Except that with the Microsoft Side by Side mechanism this is not what happens. Instead, you get the CRT version marked on the library that you compiled, and this version of the DLL is delivered to this library. This may cause the same problem that I described earlier. You are building a library in system A a year ago against one CRT. A year later, a new version appeared with an update. Your main program receives a DLL with one version of CRT, the library receives a DLL with another version of CRT, the same problem may occur.

So what are you doing? I understand that memory allocation between libraries is disapproving. But you can ignore the malloc example and come up with another one. Do you have every developer recompile each dependent library on your machine to make sure everyone uses the same CRT? Then, for release, will you recompile each library again?

How does it work on Linux? This is my main interest. Is there a CRT that ships with GCC, or does Linux itself come with CRT libraries? I have never seen CRT explicitly contact Makefils.

On Linux, what are the dynamic CRT libraries referencing? The latest on the machine, or is it a more “side by side” mechanism.

+3
source share
1 answer

Linux , : C, ABI . , , , . * NIX.

-, ++. ABI, ++. , , . : , , .

+2

All Articles