我有我需要在我的.NET 4.0應用程序中使用的非託管C++ API代碼的dll庫。但是每一個方法我嘗試加載我的DLL我得到一個錯誤:無法加載DLL(無法找到模塊HRESULT:0x8007007E)
Unable to load DLL 'MyOwn.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
我已閱讀並試圖Severa的解決方案,我已經在互聯網上找到。實在不行..
我曾嘗試使用以下方法:
[DllImport("MyOwn.dll", CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs((UnmanagedType.I4))]
public static extern Int32 MyProIni(string DBname, string DBuser_pass,
string WorkDirectory, ref StringBuilder ErrorMessage);
當我嘗試以下this article,當我運行這個例子(從下載的代碼),它運行沒有問題(使用的DLL是bin/debug文件夾)
我已經複製了我的dll(以及它依賴的所有文件到我的bin文件夾中)。
我也嘗試過這種方法,但得到了同樣的錯誤:
[DllImportAttribute(MyOwnLibDllPath, EntryPoint="TMproIni")]
[return: MarshalAs(UnmanagedType.I4)]
public static extern int MyproIni(string DBname, string DBuser_pass,
string WorkDirectory, ref StringBuilder ErrorMessage);
有什麼建議?
是它可以有所有依賴的System32文件夾和我的DLL在別的地方? –