[ocaml-ctypes] Help with strings

Jeremy Yallop yallop at gmail.com
Thu Dec 28 16:31:56 GMT 2017

On 27 December 2017 at 23:37, john skaller <skaller at internode.on.net> wrote:
> BTW: Just though I’d say, Ctypes is a pretty nice library.
> Well done! There’s no such thing as a perfect foreign interface
> to C, but Ctypes handles much of it reasonably well.

Thank you!  I appreciate the kind words.

>>   'enum' builds a 'typ' value from a mapping between constants and OCaml values
>>   http://ocamllabs.io/ocaml-ctypes/Cstubs.Types.TYPE.html#VALenum
> 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.

> Looking at the yaml example, jbuilder is used with a ppx to do this at
> during Ocaml compilation, is that correct?

I don't think there's a ppx involved, but there is a code generation
step (or, rather, a couple of code generation steps).

> Hmm. How can I contribute easily. Its too early for me to actually
> write docs. However I could create an issue with copies of your
> email comments for someone to integrate.

Issues suggesting improvements to the documentation are always welcome!

Kind regards,


More information about the Ctypes mailing list