当前位置:编程学习 > C#/ASP.NET >>

int [] 传值到 非托管 short*,问题???

原形:
DWORD line(short TAxis,short* Axis,short* Dist,long vel,long MaxVel,double T);

C#:
[DllImport("180.dll", EntryPoint = "line", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
        public static extern int line(int TAxis, ref int AxisArray, ref int Dist, int Vel, int MaxVel, double T);


调用:
int[] AxisArray=new int[2];
AxisArray[0] = 0;
AxisArray[1] = 1;
int[] DistArray = new int[2];
DistArray[0]=100;
DistArray[1]=100;

line(2, ref  AxisArray, ref  DistArray, 100, 1000, 0.1);


提示:无法从ref int[] 转换为ref int --------------------编程问答-------------------- line(2, ref  AxisArray[0], ref  DistArray[0], 100, 1000, 0.1);

--------------------编程问答-------------------- 参数应该是int, ref short , ref short ,long , long , double吧?
--------------------编程问答-------------------- caozhy :这样只能传入一个元素。是想传入整个数组。
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,