[ocaml-ctypes] Abstract 'a typ
daniel.buenzli at erratique.ch
Mon Mar 9 21:37:20 GMT 2015
Le lundi, 9 mars 2015 à 22:14, Thomas Braibant a écrit :
> I do not know what's the preferred way to handle this situation in
> ctypes. I would really like to use `abstract`, but in that particular
> case, I should really not be able to provide the size nor the
> alignement of the struct. I could use void pointers to implement foo
> pointers, but this seem a bit error prone (minor variation: use magic
> to expose `unit ptr typ` as `foo ptr typ` with `foo` a fresh type).
If your bindings are thin you should just use an OCaml abstract type that denotes pointers to void pointers. The only place where you need to be careful is in the bindings themselves but that should be trivial.
For example in tsdl:
More information about the Ctypes