我在(.dll)文件中使用 ac 函数,该文件引用结构数组并返回一个字节,该字节确定我的操作是否成功。它在 c 项目中运行良好,当我发送一个小型数组(最多 7 个元素)时运行良好,然后返回 false !
该数组来自以下结构
[StructLayout(LayoutKind.Sequential)]
public struct MainStruct
{
[MarshalAsAttribute(UnmanagedType.Struct, SizeConst = 5)]
public Struct2 Struct2Object;
[MarshalAsAttribute(UnmanagedType.U8, SizeConst = 1)]
public UInt64 Elem1;
[MarshalAsAttribute(UnmanagedType.U8, SizeConst = 1)]
public UInt64 Elem2;
[MarshalAsAttribute(UnmanagedType.U8, SizeConst = 1)]
public UInt64 Elem3;
[MarshalAsAttribute(UnmanagedType.U8, SizeConst = 1)]
public UInt64 Elem4;
[MarshalAsAttribute(UnmanagedType.U8, SizeConst = 1)]
public UInt64 Elem5;
[MarshalAsAttribute(UnmanagedType.U8, SizeConst = 1)]
public UInt64 Elem6;
[MarshalAsAttribute(UnmanagedType.U8, SizeConst = 1)]
public UInt64 Elem7;
[MarshalAsAttribute(UnmanagedType.U8, SizeConst = 1)]
public UInt64 Elem8;
};