【发布时间】:2015-11-28 06:34:12
【问题描述】:
我正在使用外部 dll,但出现此错误
ACRCloudExtrTest.exe 中出现“System.DllNotFoundException”类型的未处理异常。 附加信息:无法加载 DLL 'acrcloud_extr_windows_1.0.1.dll':找不到指定的模块。 (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);
}
【问题讨论】:
-
acrcloud_extr_windows_1.0.1.dll 是否与 ACRCloudExtrTest.exe 位于同一文件夹中?
-
它没有告诉你什么 DLL 找不到,只是这个 DLL 无法加载。如果您不知道这个需要什么其他 DLL,请使用电话或 SysInternals 的进程监视器。
-
如果在发布配置中尝试调试 bin/release,请尝试将其放入 bin/debug 目录。
-
还是不行,我觉得@HansPassant 是对的,没有加载
标签: c# visual-studio dll