现在我需要调用一个c++编写的dll(test.dll)里面有个函数
void testFunction(vector<vector<double> > m_adX,vector<vector<vector<double> > > &TriangleALL);函数说明:
vector<vector<double> > m_adX 传入的点(是由多个含X,Y,Z坐标的点组成)
vector<vector<vector<double> > > &TriangleALL 经过testFunction运算后得到的结果值我现在呢 在C#中通过P-INVOKE调用
C#声明原型:
[DllImport("test.dll",EntryPoint="testFunction",CharSet=CharSet.Auto)]
public static extern void ConverseAll(List<List<double>> m_adX, ref List<List<List<double>>> TriangleALL);调用函数:(测试所用)List<List<List<double>>> listDouble = new List<List<List<double>>>();List<List<double>> listInt = new List<List<double>>(); for (int j = 0; j < 10; j++)
{
List<double> abc = new List<double>();
listInt.Add(abc); for (int i = 0; i < 10; i++)
{
listInt[j].Add(i);
} CallCppDll.ConverseAll(listInt, ref listDouble);
}编译无误
运行时:无法封送处理“parameter #2”: 无法封送处理泛型类型。
我也查看了下MSDN 平台封送数据 是不能传递泛型类型的参数数据请问如果我按照上面的代码来做,该怎么改可以解决上面的这个问题?
如果我不这么做,有该怎么做比较好?
void testFunction(vector<vector<double> > m_adX,vector<vector<vector<double> > > &TriangleALL);函数说明:
vector<vector<double> > m_adX 传入的点(是由多个含X,Y,Z坐标的点组成)
vector<vector<vector<double> > > &TriangleALL 经过testFunction运算后得到的结果值我现在呢 在C#中通过P-INVOKE调用
C#声明原型:
[DllImport("test.dll",EntryPoint="testFunction",CharSet=CharSet.Auto)]
public static extern void ConverseAll(List<List<double>> m_adX, ref List<List<List<double>>> TriangleALL);调用函数:(测试所用)List<List<List<double>>> listDouble = new List<List<List<double>>>();List<List<double>> listInt = new List<List<double>>(); for (int j = 0; j < 10; j++)
{
List<double> abc = new List<double>();
listInt.Add(abc); for (int i = 0; i < 10; i++)
{
listInt[j].Add(i);
} CallCppDll.ConverseAll(listInt, ref listDouble);
}编译无误
运行时:无法封送处理“parameter #2”: 无法封送处理泛型类型。
我也查看了下MSDN 平台封送数据 是不能传递泛型类型的参数数据请问如果我按照上面的代码来做,该怎么改可以解决上面的这个问题?
如果我不这么做,有该怎么做比较好?
只能传基本数据类型。数组。
double[,] point = new double[,] { { x1, y1, z1 }, { x2, y2, z2 }, { x3, y3, z3 }, { x4, y4, z4 } };但是传递后 程序也是报错 Microsoft Visual C++ Debug Libray
debug error
abnormal program termination又不知道该怎么解决?
不知道到能不能这样传 麻烦你再帮我问问。
需要兼容其他语言的DLL不应该在接口中包含C++特性。