求助C#调用C++dll异常解决
来源:互联网 发布:初级数据分析师面试题 编辑:程序博客网 时间:2024/05/22 03:31
请大家帮忙的。
C++编写的dll(libgc.dll)放在当前的目录的debug目录下。
一下是我用C#写的动态调用C++dll测试方法:
ing System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
//using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace Dialogic01
{
public partial class test : Form
{
public test()
{
InitializeComponent();
}
[DllImport("libgc.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
public static extern int gc_Start(IntPtr startp);
[DllImport("libgc.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
public static extern int gc_Close(int chdev);
[DllImport("libgc.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
public static extern int gc_OpenEx(ref int linedevp, string devicename, int mode, [MarshalAs(UnmanagedType.AsAny)] Object usrattr);
[DllImport("libgc.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
public static extern int gc_GetResourceH(int linedevp, ref int resourcehp, int resourcetype);
private void button1_Click(object sender, EventArgs e)
{
try
{
gc_Close(1);
}catch( Exception ex)
{
MessageBox.Show(ex.Message);
return;
}
}
}
}
运行时:点击测试按钮出现异常:
[System.DllNotFoundException] = {"无法加载 DLL“libgc.dll”: 找不到指定的模块。 (异常来自 HRESULT:0x8007007E)。"}
我在网上查阅了很多资料都未解决,请教高手指点指点的。
- 求助C#调用C++dll异常解决
- C# 调用C++DLL参数异常解决方法
- C#调用C++DLL
- C#调用C++dll
- C#调用C++dll
- C#调用C++DLL
- c#调用c++DLL
- C# 调用C++dll
- C#调用C++DLL
- C#调用C++DLL
- C#调用C++DLL
- C#调用C++Dll
- C#调用C++DLL
- aspx调用c++dll异常
- C#调用C、C++dll
- C++封装dll并用C#调用(范例),解决C#调用C++的dll找不到入口点异常
- C#调用C的DLL
- C#动态调用C++DLL
- vc 右下角弹出提示对话框
- 灵活使用XMultipleSeriesRenderer设置自定义的轴标签
- JAVA高级01_08 与日期和时间有关的类 2011-4-21
- Fedora 启动速度很慢原因以及解决方法
- iphone静态库
- 求助C#调用C++dll异常解决
- error while loading shared libraries的解決方法
- jstl之foreach的属性
- GPS定位
- Web Services类型请求中替换XML格式的节点值的方法
- NVRAM读写操作
- Android 网络编程---STRUTS2,JSON,HttpClient
- MyEclipse8.5安装jbpm4.3插件更新至Myeclipse8.6出错的解决办法
- 儒略日反推计算日期