请问各位大侠:用C++做了一个dll,里面有一个函数,如
double Add(double* a, double* b)
{
   return *a+*b;
}
我要在C#程序里调用这个函数,关于参数如何传递,请哪位指教啊。

解决方案 »

  1.   

    参数还是double 
    [DllImport("dll文件名")]
    public static extern double Add(ref double a,ref double b);
      

  2.   

    以上问题解决,非常感谢。
    但是又来一个问题。
    我的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的入口点,为什么呢?
      

  3.   

    _declspec (dllexport) extern "C" double add(double * a,double * b)