C#如何调用C++的dll中带有指针的函数 请问各位大侠:用C++做了一个dll,里面有一个函数,如double Add(double* a, double* b){ return *a+*b;}我要在C#程序里调用这个函数,关于参数如何传递,请哪位指教啊。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 参数还是double [DllImport("dll文件名")]public static extern double Add(ref double a,ref double b); 以上问题解决,非常感谢。但是又来一个问题。我的C++的DLL是这样的_declspec (dllexport) double add(double * a,double * b){ return *a+*b;}在C#中是这样调用的:[DllImport("111.dll")]public static extern double add(ref double a, ref double b); private void button1_Click(object sender, EventArgs e) { double a= 10.5; double b= 20.6; lbResult.Text = add(ref a,ref b).ToString(); }弹出错误,说找不到Dll中add的入口点,为什么呢? _declspec (dllexport) extern "C" double add(double * a,double * b) c# 调用floodfill的问题 开源代码,大家来看看! 关于c#内存的问题 一个没解决的问题:关于继承的datagridview控件,高手进来看看 ~想问问~有没有程序员玩游戏~而且此游戏对程序思路有所帮助的~ 困扰很久的一个C#编译错误 用C#来编写串口通信数据采集软件 时间数据类型 asp.net 发布问题??? c#绘制应力分布云图的方法 C#中如何使ComboBox禁止粘帖 求winform 中通用的数据效验函数
[DllImport("dll文件名")]
public static extern double Add(ref double a,ref double b);
但是又来一个问题。
我的C++的DLL是这样的
_declspec (dllexport) double add(double * a,double * b)
{
return *a+*b;
}在C#中是这样调用的:[DllImport("111.dll")]
public static extern double add(ref double a, ref double b); private void button1_Click(object sender, EventArgs e)
{
double a= 10.5;
double b= 20.6;
lbResult.Text = add(ref a,ref b).ToString();
}弹出错误,说找不到Dll中add的入口点,为什么呢?