Which version of VC ++ execution do I choose - static or dynamic?

I am developing a 64-bit VC ++ ATL COM server that basically just redirects all calls to the out-of-process COM server. So my COM server basically does nothing.

He originally used the C ++ runtime in the DLL ( /MD) compiler . I noticed that when I deploy it on a pure 64-bit Win2k3, regsvr32 fails with the error: LoadLibrary ({fileName}) failed - this application could not be started because the application configuration was incorrect. Reinstalling the application may fix this problem.

Google helps - the problem is that the VC ++ 9 runtime is not installed. The problem persists even when msvcr90.dll is in the same directory as my COM server. This, I believe, is related to how the search for dependent libraries works - it does not look at the same directory, and I need the msvcr90.dll file in Windows \ System32 or the like. Since this is a complication for my deployment, I switched to using the statically linked C ++ runtime (/ MTM compiler). Now it works great. The size of the DLL file is only 110 KB (45 KB), so it does not bother me.

Now I heard a lot about how bad it is to mix different versions of C ++ in one process - the state of CRT can be broken, hell can break, etc. Should I think about this and expect problems from changing / MD to / MT, especially since I don’t know which version the COM server users are using?

+3
source share
2 answers

As far as I know, Static runtime is deprecated in VS after VS2005.

The problem is that the Visual C runtime is a parallel dll. That is, it must be loaded from the directory c:\windows\winsxs. This is why placing it in the same directory no longer works.

The correct solution is to install the correct CRT distributed in the client system.

. http://msdn.microsoft.com/en-us/library/ms235316.aspx

: http://www.microsoft.com/downloads/details.aspx?familyid=BD2A6171-E2D6-4230-B809-9A8D7548C1B6&displaylang=en

, dll runtime winsxs.

+2

.

DLL ( , ). , .

+1

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


All Articles