Problem loading C runtime library from executable and DLL

大城市里の小女人 提交于 2019-12-12 06:03:50

问题


I have a WPF application using .Net 3.5, which loads the C runtime library from: c:\windows\winsxs\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4926_none_508ed732bcbc0e5a\MSVCR90.DLL. Let's call this MyApp.Exe

That same folder also includes msvcp90.dll and msvcm90.dll.

When I launch a certain dialog, I need to load a certain DLL which is a C++ DLL using CLR (let's call this MyPlugin.dll). MyPlugin.dll is located in the same folder as MyApp.exe, however by using depends.exe I can see that it doesn't find msvcm90.dll or msvcp90.dll.

If I try to simply copy msvcm90.dll and msvcp90.dll to the same folder as MyPlugin.dll, it does find the DLLs but I get an error R6034 "An application has made an attempt to load the C runtime library incorrectly".

How do I get around this? Is there any way to make MyApp.exe simply look for the runtime DLLs in the current folder?

[Edit]

I created a C++ executable (let's call it CExec.exe) which tries to load MyPlugin.dll, and put it in the same folder as MyPlugin.dll and MyApp.exe. CExec.exe is able to load MyPlugin.dll, but MyApp.exe (a C# application) cannot load MyPlugin.dll. I have a feeling my problem is related to this: http://connect.microsoft.com/VisualStudio/feedback/details/361682/vc9-sp1-generates-manifests-with-the-wrong-version-number

来源:https://stackoverflow.com/questions/5570472/problem-loading-c-runtime-library-from-executable-and-dll

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!