Advantages of msvcr100 over msvcrt

I would like to ask if there is an advantage in msvcr100 over msvcrt and what will be the advantages.

When compiling with the msvc compiler, the executable that I get is linked to msvcr100, so it requires installing MS Visual C ++ Redistributable. If I compile it with g ++ (mingw), then there will be no such requirement. I assume this is due to msvcrt.

I prefer to keep dependencies at a minimum, so I want to know if it makes sense to use a compiler that refers to mscvr100.

Thanks.

+4
source share
2 answers

Msvcrt.dll is a private DLL intended for use only by Windows itself. Different versions of Windows have different versions of msvcrt.dll.

You will have a serious headache when you find that using CRT is crashing on a specific version of Windows. Including a crash that requires a time machine, a new version of Windows may have a new copy of the msvcrt.dll file, which causes your program to fail. A problem otherwise known as a DLL Hell.

The advantage of using msvcr100.dll is that the chances of success are much less. You are working with a well-known version of CRT. Even if a violation occurs in Windows itself that breaks msvcr100.dll, then there is a solution: you can update it. This is not possible with msvcr.dll, it is a DLL that is protected by the file system protection function. Overwriting it with the installer will usually be quite disastrous, as this can damage Windows. But it cannot cause a crash; Windows will automatically repair it. Also the reason you should not follow the recommendations of Voith.

+5
source

If you use the MS compiler later than version 6, you will have to reference the runtime specific to that compiler. You have no choice in this matter. Since MSVC runtime is not a system DLL, you will need to distribute them with your application.

If you use MSVC6 or a compiler that can link to msvcrt.dll, you can link it to msvcrt.dll.

The mingw compiler is quite configurable. However, I find that it is usually associated with msvcrt.dll. Since msvcrt.dll is a system DLL (with Windows 2000 IIRC), you do not need to distribute it.

I assume in all of this that you are dynamically referencing a production environment. This is the preferred option, but static can always be associated with time. When you do this, you will make your application standalone.

It all depends on which compiler you prefer to use. If you prefer to use modern MSVC, you need to accept the runtime distribution or the link statically.

+3
source

Source: https://habr.com/ru/post/1493691/


All Articles