Jeff Whitaker <jswhit@xxxxxxxxxxx> writes:
> int ncid, typeid, varid, dimid, retval;
> char name[NC_MAX_NAME + 1];
> int dimids[] = {0};
>
> struct s1
> {
> short i;
> long long j;
> /*};*/
> } __attribute__ ((__packed__));
>
Howdy Jeff!
Your trouble is in your use of __attribute__ ((__packed__)).
This changes the packing of C structs, and that will not work, because
HDF5 has already figured out how your C compiler packs structs, and if
you change it, the HDF5 layer will become very confused.
If you wish to change the packing of structs by your C compiler, you
must do so with CFLAGS, and you must use the same CFLAGS when building
HDF5, then you must also use the same CFLAGS when building netCDF, and
the same CFLAGS whenever you compile user programs with compound types.
Without the "__attribute__ ((__packed__)) " this example works just
fine. In fact, I have incorporated it into libsrc4/tst_compounds.c.
Thanks,
Ed
--
Ed Hartnett -- ed@xxxxxxxxxxxxxxxx