我在调用siinterface.dll 出现一些错误
一种办法:我直接通过添加引用 添加siinterface.dll,提示错误"未能添加对"E:\HongYang\SiInterface.dll"的引用.
第二种办法:
[DllImport("SiInterface")]
static extern int INIT(string asd);
[DllImport("SiInterface")]
static extern int BUSINESS_HANDLE(string asd,string aaa);
结果在 调用 INIT("323");的时候出现"无法加载 DLL“SiInterface”: 找不到指定的模块。 (异常来自 HRESULT:0x8007007E)。"
第三种办法: 通过win32的LoadLibrary(),GetProcAddress自动加载dll和函数地址;
[DllImport("kernel32.dll")]
private extern static IntPtr LoadLibrary(String path);
[DllImport("kernel32.dll")]
private extern static IntPtr GetProcAddress(IntPtr lib, String funcName);
hLib = LoadLibrary(DLLPath);//DLLPath="C:\dll\SiInterface.dll"
IntPtr api = GetProcAddress(hLib, APIName);
(Delegate)Marshal.GetDelegateForFunctionPointer(api, t);
返回hLib,api 的值总是0.
以上全是在.net2.0下的应用第四种:用dephi调用的时候出现"Access violation at 7C821689" in module 'kernel32.dll'.Write of address 692E6557"
一种办法:我直接通过添加引用 添加siinterface.dll,提示错误"未能添加对"E:\HongYang\SiInterface.dll"的引用.
第二种办法:
[DllImport("SiInterface")]
static extern int INIT(string asd);
[DllImport("SiInterface")]
static extern int BUSINESS_HANDLE(string asd,string aaa);
结果在 调用 INIT("323");的时候出现"无法加载 DLL“SiInterface”: 找不到指定的模块。 (异常来自 HRESULT:0x8007007E)。"
第三种办法: 通过win32的LoadLibrary(),GetProcAddress自动加载dll和函数地址;
[DllImport("kernel32.dll")]
private extern static IntPtr LoadLibrary(String path);
[DllImport("kernel32.dll")]
private extern static IntPtr GetProcAddress(IntPtr lib, String funcName);
hLib = LoadLibrary(DLLPath);//DLLPath="C:\dll\SiInterface.dll"
IntPtr api = GetProcAddress(hLib, APIName);
(Delegate)Marshal.GetDelegateForFunctionPointer(api, t);
返回hLib,api 的值总是0.
以上全是在.net2.0下的应用第四种:用dephi调用的时候出现"Access violation at 7C821689" in module 'kernel32.dll'.Write of address 692E6557"
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货