[ocaml-ctypes] Help with strings

Jeremy Yallop yallop at gmail.com
Thu Dec 28 18:54:08 GMT 2017

On 28 December 2017 at 17:04, john skaller <skaller at internode.on.net> wrote:
>> 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.

Fair enough -- checking the ABI at configuration time could be made to
work, too.  But would there be much benefit?  Wouldn't it still be
necessary to generate C code (or do something similar, like parse
headers and evaluate constant expressions) to retrieve the values of
enumeration constants?

More information about the Ctypes mailing list