<div dir="ltr">This looks really promising. Thanks!<br><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-05-28 4:36 GMT+02:00 Jeremy Yallop <span dir="ltr"><<a href="mailto:yallop@gmail.com" target="_blank">yallop@gmail.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">On 20 May 2014 14:53, Philippe Veber <<a href="mailto:philippe.veber@gmail.com">philippe.veber@gmail.com</a>> wrote:<br>
> Thanks a lot Jeremy for your answer! I have chosen to write helper C<br>
> functions to access the records containing bitfields, so that I let the<br>
> compiler do its business without caring too much. I guess that no field<br>
> after a bitfield definition in a struct can be reliably accessed either<br>
> (with ctypes), even if it's not a bitfield itself (as there is no means to<br>
> know if the bitfield was packed or padded). Is that right?<br>
<br>
</div>Yes, I think that's strictly true, although it's probably possible to<br>
predict how things will be laid out in particular cases.<br>
<br>
In a future release there'll be the option to query the C compiler<br>
about struct layout directly, at which point we should have better<br>
guarantees about access to structs with bitfields:<br>
<br>
<a href="https://github.com/ocamllabs/ocaml-ctypes/pull/62" target="_blank">https://github.com/ocamllabs/ocaml-ctypes/pull/62</a><br>
<span class="HOEnZb"><font color="#888888"><br>
Jeremy.<br>
</font></span></blockquote></div><br></div>