NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
Jeff Whitaker <jswhit@xxxxxxxxxxx> writes: > Concerning packing of structs, one of us is very confused about how > HDF5 compound types work (and it's probably me). I thought that you > could specify arbitrary offsets that do not necessarily correspond to > the default alignment of your C compiler, and HDF5 would take care of > everything when you read the data back in. No, sorry, this turns out not to be the case. > Otherwise, how would you > read a file created with HDF5 on a platform with a different default > alignment than the one it was written on? Isn't the whole point of > the HDF5 layer that you don't have worry about the default alignment > of structs for the C compiler? HDF5 can handle it, but not if you change the alignment of your struct with a compiler directive! HDF5 figures out packing when it is built on your machine, in the HDF5 configure script. Using any other packing than the one HDF5 figured out at its build time will result in confusion. So if you want a different packing of your struct, you must specify the packing options you want with compiler flags, and make sure you use those flags when building HDF5 (and netCDF-4, and your own program). I have forwarded your question to the HDF5 team to ensure that I am telling you the correct answer, and to see if they can help explain this any more clearly. Thanks! Ed -- Ed Hartnett -- ed@xxxxxxxxxxxxxxxx
netcdfgroup
archives: