2015-08-06 22:20 GMT+02:00 Petr KLAPKA <[email protected]>:
> Hello folks,
>
> I've been beating my head against this one all day... All I'm trying to
> do is write a simple struct to a dataset. Using C# and the .NET wrapper,
> if I remove the array from the struct, all is well, but once I introduce
> the array, the data in the file is mangled (as shown). Any clues? Also,
> is there a way to get h5dump to output the values in hex? I found nothing
> in the documentation and it would be super useful for debugging. Thanks in
> advance!
>
> [StructLayoutAttribute(LayoutKind.Sequential, Pack = 1)]
> struct cStyleMessage
> {
> public uint MsgID;
> public ulong MsgHWTimestamp;
> public uint MsgLenthBytes;
> [MarshalAs(UnmanagedType.ByValArray,
> ArraySubType=UnmanagedType.U1, SizeConst=8)]
> public byte[] MsgBody;
> }
>
I am not a Windows person, so don't know how the MSC# is dealing with the
alignment of structures, but I would try:
struct cStyleMessage
{
public uint MsgID;
public uint MsgLenthBytes;
public ulong MsgHWTimestamp;
[keep the rest the same]
}
If that does not help, then my advice is to start with a compound type of a
single field, see if that works, and then proceed with 2 fields. When you
reach this point you will be able to figure out how to generalize more
easily.
--
Francesc Alted
_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5