05.05.2014 15:57, Werner Benger пишет:
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?

As far as I know, there is no universal solution. For example, some time ago I tried to use UContext interface as described in http://pubs.opengroup.org/onlinepubs/007908799/xsh/ucontext.h.html from FreePascal. It turned out that actual binary C structs are very different in Linux and FreeBSD (and I think they are different on different Linuxes), let alone compiler alignment issues. I had to give up.

On Windows, all WinAPI public structs are declared as "packed", i.e. they do not have alignment.

Here are my considerations from user perspective:

1) C struct layout is a part of binary interface.

2) Binary interface should be clearly and completely defined by specification.

3) Currently C record layout is not completely defined. Thus, binary specification cannot be considered complete.

4) From all possibilities, non-aligned records are most easy to use.

Best wishes,
Andrey Paramonov


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


_______________________________________________
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