i use a c function in a (.dll) file that takes a reference to array of struct and returns a byte that determines whether my operation is succeed or not.
it works well in the c project
and worked well when i send a small size array(up to 7 elements)
and false after that !!
the array is from the following struct
[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;
};
that`s the used function.
and this is the struct in C
the marshal of the function is
the point is that it works well in C and works well in the windows form application too if the size of the array passed to the function is 7 or less !