Problem loading C runtime library from executable

2019-09-13 15:37发布

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

0条回答
登录 后发表回答