[ocaml-ctypes] Help with strings

john skaller skaller at internode.on.net
Thu Dec 28 17:04:09 GMT 2017

> On 29 Dec. 2017, at 03:31, Jeremy Yallop <yallop at gmail.com> wrote:

>> Hmm. What does it mean when it says “the size and alignment are retrieved”??
>> The only way to do that would be to generate C code and measure it.
> Indeed, that's exactly what happens.  The C standard doesn't place
> many constraints on the layout of enums, so there isn't really another
> way of building enum types that’s guaranteed to work.

Layout rules in general for C are fully fixed by the ABI.
That’s platform dependent BUT you only need to figure out
the ABI once per platform. Otherwise, there’d be no way
to bind to the C standard library which is usually the vendor
provided access to the OS kernel.

john skaller
skaller at users.sourceforge.net

More information about the Ctypes mailing list