点点滴滴访问量:
摘要: 带有指针数组的结构体不能直接转换为C#类型的结构体,转换起来有点麻烦先定义出对应C++类型的C#结构体 public struct user_group_t { public int id; public string name; } public struct user_group_list { public int group_array_count; public IntPtr group_... 阅读全文
posted @ 2010-04-13 11:41 sopper 阅读(6853) 评论(2) 推荐(0) 编辑
摘要: 最近使用C#调用C++版本的dll遇到很多类型转换的问题,现记录出容易出错的部分C#对于C++的dll引用时,经常会遇到类型转换和struct的转换1. C++ 里的Char类型是1 个字节,c#里的Char是两个字节,不可以对应使用;可使用c#里的byte对应2. structType temp = (structType)Marshal.PtrToStructure(IntPtr, typeo... 阅读全文
posted @ 2010-04-13 10:26 sopper 阅读(912) 评论(0) 推荐(0) 编辑