请教结构数组异常的问题(很急,很急,多谢了)?

sky 2003-11-10 06:24:56
我在VC++.NET中定义了两个结构A,B 其中A包括了一个B[10]得结构数组,将这两个结构的指针作为函数的参数FUN(A* a,B* b),在VB.NET中调用的时候出现了以下异常
其他信息: 无法封送类型 A 的字段 B:该类型无法作为结构字段进行封送处理。

请教各位了?
...全文
24 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
sky 2003-11-11
  • 打赏
  • 举报
回复
多谢这位高手了,我的这两个结构确实是定义在接口中的,但是use a memory block (or, byte[]) to catch the output and then use Marshal.PtrToStructure to convert them to proper objects.具体的做法应该是怎样的呢,就结合我的实际情况,怎样才能把这个结构数组传出来呢?
qqchen79 2003-11-11
  • 打赏
  • 举报
回复
Try to avoid using nested structs in PInvoke/Interop.
This part is buggy in .NET framework.

Instead, you can always use a memory block (or, byte[]) to catch the output and then use Marshal.PtrToStructure to convert them to proper objects.

7,540

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 VC.NET
社区管理员
  • VC.NET社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧