我在我的C#应用程序中使用了
DllImport
。它在我的Windows 7机器上运行良好,但在Windows 8上会出现DllNotFoundException。我们的一个客户在他的Windows 7机器上也遇到了同样的问题。我甚至对代码进行了一些修改以测试,比如提供绝对路径。[DllImport("C:\\Program Files (x86)\\MyApp\\A.dll", CallingConvention = CallingConvention.Cdecl)]
private static extern void foo(string filename, MulticastDelegate callback);
但是它仍然在路径C:\Program Files (x86)\MyApp\A.dll处给出了DllNotFoundException异常....
但是DLL确实在那里!!!....
c:\program files\
而不是c:\program files (x86)\
。 - spender