C++的双指针在C#中对应的写法是怎样的

比如: float * 写成 float[],或IntPtr什么的

而类似下面这样该怎么接收呢,求高手指教,谢谢

extern "C" DLLTEST_API float** test(float** c){

int lenth = 3;

float** arr = new float *[lenth];

for (int i = 0; i < lenth; i++)

{

arr[i] = new float[lenth];

}

for (int r = 0; r < lenth; r++)

{

for (int c = 0; c < lenth; c++)

{

arr[r][c] = (float)( (lenth * r) + c + 1);

}

}

c = arr;

return c;

}

我试了这样写是错误的

[DllImport("DLLTEST")]

public static extern IntPtr[] test(ref float[] arrName);

一般可以采用括号把想要转换的数据类型括起来放在值左边. 它实际上是让编译器"忘记类型检查,把它看作其他类型".

标准c++显示转换语法

static_cast: 非强制转换,窄化转化,void*强制变换
const_cast:对const,volatile进行转换
reinterpret_cast:转换为完全不同的意思.
dynamic_caset:用于类型安全的向下转换.

static_cast<int>(i);
static_case<char>(i)
温馨提示:答案为网友推荐,仅供参考
第1个回答  2017-08-31
IntPtr 不要数组,,,,,参数也是追问

意思说写成这样,是吗,试了的,不行,返回不了数据
public static extern IntPtr test(ref float arrName);