我用C#调用dll的函数,在函数当中返回二维数组,请问有什么方法呢?
我在网上看了很多方法,很多都不管用,后来看到一个可以在C++中返回二维数组的方法
C++代码如下//Cpp代码
typedef int (*PTR)[4];
TREEDLL_API PTR printDegree()
{
getReTree(root, 0);
reTree[0][1] = allDegree;
int (*x)[4] = reTree;
return x;
}
//接口页面代码
extern "C" TREEDLL_API typedef int (*PTR)[4];//用于传递PTR类型到C#
extern "C" TREEDLL_API PTR printDegree();以上代码可以顺利编译通过。
但在C#中调用这个函数的时候出问题了/*
//  没有这一段时程序说没定义PTR,有这一段时程序说这个声明无效
    [DllImport("D:\\inetpub\\MuiscPlatform\\user\\TreeDLL.dll", EntryPoint = "printDegree", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
    public extern static typedef int (*PTR)[4];
*/
    [DllImport("D:\\inetpub\\MuiscPlatform\\user\\TreeDLL.dll", EntryPoint = "printDegree", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
    public extern static PTR printDegree();
我应该怎么办呢?希望大家可以帮帮我~~~~~