日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

C#调C++生成的dll报0x800736B1错误

發(fā)布時間:2024/4/11 59 豆豆
生活随笔 收集整理的這篇文章主要介紹了 C#调C++生成的dll报0x800736B1错误 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

2019獨角獸企業(yè)重金招聘Python工程師標準>>>

這個錯誤看上去好像是 C++ DLL庫本身的問題,其實并不盡然。由于使用了混合模式編譯托管 DLL ,所以該 DLL 又會用到非托管的?CRT?( C Run-Time )庫。如果機器上沒有安裝這些被使用到的運行時組件,就會產生類似 HRESULT: 0x8007 的錯誤。

?????? 要注意的是,如果你編譯 C++ 托管程序集的時候使用的是 Debug 配置的話,生成的 DLL 需要調用的就是 CRT 對應的 debug 版本( msvcr80d.dll 及 msvcm80d.dll 等 )而不是(msvcm80.dll及 msvcp80.dll等)。了解生成的 DLL 到底是 Debug 還是 Release 版本最簡單的方法是用文本編輯器打開該 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>??
  • <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>

    ?

    如果看到?Microsoft.VC80.DebugCRT?,那說明該 dll?Link的目標是 CRT的Debug版本,如果是Microsoft.VC80.CRT?則 link 到再分發(fā)版本。當我在 VS.net2005 的 IDE 中通過批生成來生成 C# exe 和 C++ dll 的時候,如果當前的活動解決方案配置是 Debug 的話,在 C# 項目的Release輸出目錄下拷貝的會是 C++ dll 的 Debug 版本文件而不是 Release 版本!所以在發(fā)布生成之后確認對應文件的版本還是相當有必要的。

    下面是兩種模式需要的文件及目錄位置,根據(jù)模式將相應的文件拷入安裝目錄即可解決上述問題

    狀態(tài)?: Debug Mode

    ???? \Microsoft Visual Studio 8\VC\redist\Debug_NonRedist\x86

    ????????? |
    ????????? -> \Microsoft.VC80.DebugCRT
    ?????????????? |
    ?????????????? -> Microsoft.VC80.DebugCRT.manifest, msvcm80d.dll, msvcp80d.dll, msvcr80d.dll
    ??狀態(tài) : Relsase Mode
    ?????
    ???? \Microsoft Visual Studio 8\VC\redist\x86
    ?????????
    ????????? |
    ????????? -> \Microsoft.VC80.CRT
    ?????????????? |
    ?????????????? -> Microsoft.VC80.CRT.manifest, msvcm80.dll, msvcp80.dll, msvcr80.dll

    如何生成Release 版本:

    ???? 將運行按鈕右邊的解決方案配置改為Release模式,然后生成即可

    轉載于:https://my.oschina.net/duluo180/blog/29730

    總結

    以上是生活随笔為你收集整理的C#调C++生成的dll报0x800736B1错误的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。