大虾们,怎么没有人回我问题?我看了关于dllimport的用法.可返回的树结构还是没有正确.树是这样的 struct tree { struct tree *child_list; struct tree *next_peer; struct enum_list *enums; }; struct enum_list { struct enum_list *next; };我把它写成 [StructLayout(LayoutKind.Sequential)] public class tree { public tree child_list; public tree next_peer; public enum_list list; } [StructLayout(LayoutKind.Sequential)] public class enum_list { public enum_list list; }; 可提示成员list没有布局信息
http://blog.daviesliu.net/article/entry20050805-230945
这个里边说明数据类型的对照关系
http://www.njpro.cn/8918/ShowPost.aspxC#里边调用函数时,如果不能避免使用指针,那么只要在函数前边加上unsafe关键字
就可以使用类似char *、&a的东西,但是不到万不得以,不建议这样使用
用法是一样的啊
加上dllimport和声明就可以用了
struct range_list *next;
int low, high;
};
在c#中应该怎么该写.要写成类吗?
{
struct tree *child_list;
struct tree *next_peer;
struct enum_list *enums;
};
struct enum_list
{
struct enum_list *next;
};我把它写成
[StructLayout(LayoutKind.Sequential)]
public class tree
{
public tree child_list;
public tree next_peer;
public enum_list list;
}
[StructLayout(LayoutKind.Sequential)]
public class enum_list
{
public enum_list list;
};
可提示成员list没有布局信息