Hi Ed,
> There's something I just don't understand here.
>
> Suppose, on machine A, that I have an array of C struct data, of type
> "struct s1", and using HOFFSET, I create a compound type. Then I write
> a bunch of data.
>
> Then, on machine B, which packs its structs differently, I open the
> file, and read the data into an array of the same "struct s1". Will my
> data be messed up because of the different padding on machine B?
>
> I can see that, using the HOFFSET macro, you adjust the compound type
> to the actual struct when the file is created, because of the
> H5Tcompound_insert calls. But readers don't give you any information
> about the C struct they are reading into. How do you know the padding
> isn't different?
Readers should either contruct the datatype describing their C struct with
H5Tcompound_insert, etc. or they should use H5Tget_native_type on the datatype
from the file. Either way will get the padding set up correctly.
If they "know" the type that's in the file, using H5Tcompound_insert is
somewhat more straightforward because otherwise they will need to query the
field information from the datatype returned from H5Tget_native_type in order
to get the field offsets, etc. and then also read the data into a "generic"
buffer and translate it into their array of C structs.
Quincey