![](/img/trans.png)
[英]Exception when initialize dll in c# generated by MATLAB Compiler
[英]matlab dll throws exception when used in C# .NET
我正在一個需要曲線擬合的項目中。 為了獲得最佳結果,我選擇使用MATLAB工具箱。 我創建了此代碼的dll,並嘗試在C#.NET框架中使用它。 該dll在一個系統上成功運行,但在其他任何系統上都無法成功運行。 我得到以下異常:
Unhandled Exception: System.TypeInitializationException: The type initializer fo
r 'curve.cfit' threw an exception. ---> System.TypeInitializationException: The
type initializer for 'MathWorks.MATLAB.NET.Utility.MWMCR' threw an exception. --
-> System.TypeInitializationException: The type initializer for 'MathWorks.MATLA
B.NET.Arrays.MWArray' threw an exception. ---> System.DllNotFoundException: Unab
le to load DLL 'mclmcrrt7_17.dll': The specified module could not be found. (Exc
eption from HRESULT: 0x8007007E)
at MathWorks.MATLAB.NET.Arrays.MWArray.mclmcrInitialize2(Int32 primaryMode)
at MathWorks.MATLAB.NET.Arrays.MWArray..cctor()
--- End of inner exception stack trace ---
at MathWorks.MATLAB.NET.Utility.MWMCR..cctor()
--- End of inner exception stack trace ---
at curve.cfit..cctor()
--- End of inner exception stack trace ---
at curve.cfit..ctor()
我想知道為什么會這樣,如何解決這個問題? 我需要在多台機器上部署我的項目。 我該怎么辦?
先感謝您 :)
該錯誤告訴您該程序找不到mclmcrrt7_17.dll。 這是您需要在每台目標計算機上部署的MATLAB編譯器運行時的一部分。 看來您尚未部署MATLAB編譯器運行時。
可在此處找到運行時可重新分發的文件: http : //www.mathworks.co.uk/products/compiler/mcr/index.html
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.