We have two dlls say A and B. Both use different versions of library C which is linked statically into them.
Now when we load these dlls in a executable, and use their functionality the program crashes.
Can someone explain the reason behind this and how to fix it?
We could see this issue in XP only and it works fine in Windows 7 (somehow)
The program crashes because different versions of the C DLL have different type definitions which conflict with each other. If you have certain fields that don’t exist in one version and exist in another, then depending on the type of the DLL, you’ll get 2 different scenarios. Managed will fail to bind and will tell you that. Unmanaged will corrupt memory and you will get some nasty error elsewhere unexpectedly.
You’re seeing different behavior between OSes probably because XP does its memory management differently than 7 (leading me to believe it’s unmanaged DLLs), but it’s tough to tell.