Privet, Andrey!

I'm wondering on this occasion, if using structs in an C API is an issue, how do system libraries do it, for instance int fstat(int fd, struct stat *buf); where "struct stat" is a header-defined C struct as well. The same mechanism should be applicable to HDF5 as well, if there are problems?

Poka,

Werner


On 05.05.2014 13:35, Андрей Парамонов wrote:
Hello HDF5 developers!

HDF5 library exposes a number of functions which take parameters in form of C struct (H5E_error2, H5G_info_t, H5FD_class_t etc). It means that C structs are efficiently a part of binary interface. However, such interface causes some problems:

1) C struct layout is not guaranteed to be binary compatible among C compilers. Even more, the same compiler may produce binary incompatible struct layouts depending on compiler flags.

2) Languages other than C, although often having a notion of tuple/record/struct, rarely have the exact, binary-compatible equivalent of C struct (given 1), it's clear why). For example, both Delphi "record" and Delphi "packed record" are not guaranteed to be binary compatible with public structs from official HDF5 library release. It makes using advanced HDF5 features from non-C languages harder.

It would be of great help if public HDF5 C structs were of some documented, easy-to-support format, most preferably without field alignment (Delphi "packed record"). Or maybe there is at least some compiler flag to force no alignment for *public* structs (forcing no alignment for all structs might be bad for performance, I presume)?

Best wishes,
Andrey Paramonov


--
___________________________________________________________________________
Dr. Werner Benger                Visualization Research
Center for Computation & Technology at Louisiana State University (CCT/LSU)
2019  Digital Media Center, Baton Rouge, Louisiana 70803
Tel.: +1 225 578 4809                        Fax.: +1 225 578-5362


_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://mail.lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org

Reply via email to