天天看點

VC2008 下 R6030錯誤

REF 一個解決方法,實驗通過

#pragma comment(linker, "\"/manifestdependency:type='Win32' name='Microsoft.VC90.CRT' version='9.0.21022.8' processorArchitecture='X86' publicKeyToken='1fc8b3b9a1e18e3b' language='*'\"") 不同版本的編譯器,name和version可能不同,具體在debug目錄下的*.manifest中查找

沒有試驗成功,僅供參考 runtime exception R6034: "...attempt to load the C runtime library incorrectly..." I spent  a week's hard work on this issue, come to the following conclusion:

(1) The problem: A.EXE depends on {B.DLL, MSVCR80D.DLL}; B.DLL depends on {MSVCR80.DLL}; A.EXE runs into exception R6034, as the title.

(2)  The fix: replace B.DLL with  B_DEBUG.DLL, which  provides the same API as B.DLL but  depends on {MSVCR80D.DLL}, and get A1.EXE. A1.EXE runs fine.

(3) reasoning and conclusions:

(3.1)Check the embeded manifest of B_DEBUG.DLL:

  <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">

  <dependency>

      <dependentAssembly>

          <assemblyIdentity type="win32" name="Microsoft.VC80.DebugCRT" version="8.0.50608.0" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>

      </dependentAssembly>

  </dependency>

</assembly>

(3.2) Check the embeded manifest of B.DLL:

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">

  <dependency>

      <dependentAssembly>

          <assemblyIdentity type="win32" name="Microsoft.VC80.CRT" version="8.0.50608.0" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>

      </dependentAssembly>

  </dependency>

</assembly>

(3.3) Hypothesis01: Microsoft.VC80.DebugCRT and Microsoft.VC80.CRT share the common publicKeyToken "1fc8b3b9a1e18e3b", so the "assembly" loading mechanism get into a mess.

(3.4) Hypothesis02: If compile and link B.DLL with VC6.0,  then no "assembly" conception  nor "assembly loading mechanism", nor the R6034 exception.

(3.5) Conclusion01: The statement "An application has made an attempt to load the C runtime library without using a manifest" miss the point and some enhancement of document is necessary.