C# application that uses unmanaged code loads msvcr90.dll + msvcr80.dll + msvcr100.dll. Does this matter?

StackOverflow https://stackoverflow.com/questions/18130316

Question

I'm currently debugging a C# application that calls unmanaged dlls. Different unmanaged dlls appear to be linked against different versions of the C runtime library.

Is this likely to cause problems? The types of problems I was thinking of are things like duplicated global variables causing confusion such that runtime code writes to one global and user code reads from another, eg. _errno.

Était-ce utile?

La solution

Having multiple copies of the CRT loaded in a large program is nothing unusual. .NET 2.0 through 3.5SP1 will for example load msvcr80.dll, used by the CLR and the jitter. Windows itself will load msvcr.dll. If you have a dependency on a few COM servers or interop with C++ code then you'll get the CRT version loaded that they depend on. These copies stay out each other's hair, they have their own static variables and allocate their own heap. Do note that deploying such a program might not be the greatest joy :)

It only goes wrong when code in one DLL calls the code in another DLL, those DLLs have their own copy and they are trying to share their allocator or globals. This should not be an issue in a C# program, you'd expect the C or C++ programmer(s) to have sorted this out in their design.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top