我使用的外部DLL,但我得到這個錯誤外部DLL的Visual Studio C#錯誤
An unhandled exception of type 'System.DllNotFoundException' occurred in ACRCloudExtrTest.exe. Additional information: Unable to load DLL 'acrcloud_extr_windows_1.0.1.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
我已經把項目文件夾中的DLL,也SYSTEM32和SYSWOW64,但毫無效果。
我在這裏調用DLL:
class ACRCloudExtr
{
public static byte[] CreateFingerprint(byte[] pcmBuffer)
{
byte[] fpBuffer = null;
if (pcmBuffer == null || pcmBuffer.Length <= 0)
{
return fpBuffer;
}
IntPtr pFpBuffer = IntPtr.Zero;
int fpBufferLen = create_fingerprint(pcmBuffer, pcmBuffer.Length, ref pFpBuffer);
if (fpBufferLen > 0)
{
fpBuffer = new byte[fpBufferLen];
Marshal.Copy(pFpBuffer, fpBuffer, 0, fpBufferLen);
free_fingerprint(pFpBuffer);
}
return fpBuffer;
}
[DllImport("acrcloud_extr_windows_1.0.1.dll")]
private static extern int create_fingerprint(byte[] pcm_buffer, int pcm_buffer_len, ref IntPtr fps_buffer);
[DllImport("acrcloud_extr_windows_1.0.1.dll")]
private static extern void free_fingerprint(IntPtr fps_buffer);
}
與ACRCloudExtrTest.exe位於同一文件夾中的是acrcloud_extr_windows_1.0.1.dll嗎? – Polyfun
它不會告訴你什麼DLL無法找到,只有這個DLL不能*加載*。如果你不知道這個需要的其他DLL,那麼可以使用電話或SysInternals的Process Monitor。 –
是http://prntscr.com/8bt9i0 – user3181034