[ocaml-ctypes] Bit field encoding.

Philippe Veber philippe.veber at gmail.com
Wed May 28 07:14:00 BST 2014


This looks really promising. Thanks!



2014-05-28 4:36 GMT+02:00 Jeremy Yallop <yallop at gmail.com>:

> On 20 May 2014 14:53, Philippe Veber <philippe.veber at gmail.com> wrote:
> > Thanks a lot Jeremy for your answer! I have chosen to write helper C
> > functions to access the records containing bitfields, so that I let the
> > compiler do its business without caring too much. I guess that no field
> > after a bitfield definition in a struct can be reliably accessed either
> > (with ctypes), even if it's not a bitfield itself (as there is no means
> to
> > know if the bitfield was packed or padded). Is that right?
>
> Yes, I think that's strictly true, although it's probably possible to
> predict how things will be laid out in particular cases.
>
> In a future release there'll be the option to query the C compiler
> about struct layout directly, at which point we should have better
> guarantees about access to structs with bitfields:
>
>    https://github.com/ocamllabs/ocaml-ctypes/pull/62
>
> Jeremy.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ocaml.org/pipermail/ctypes/attachments/20140528/ef2f6d5f/attachment.html>


More information about the Ctypes mailing list