Inverse stubs behave contravariantly wrt pointers.
Inverse stubs behave contravariantly wrt pointers.

Since 18325e0 we have a new principle for pointers: fatptr values are
constructed in OCaml and destructed in C.  The change showed up an issue in
inverse stub generation: we need to treat the types of generated stubs
contravariantly.  For example, a type of

   ptr int @-> returning (ptr int)

generates a C stub with type

   _ fatptr -> voidp

i.e. a stub that accepts a fatptr from OCaml and returns a raw pointer, but
the corresponding inverse stub generation involves registering a function of
type

   voidp -> _ fatptr

i.e. a function that accepts a rawptr from C and returns a fatptr.

whitequark/ocaml-ctypes,dsheets/ocaml-ctypes,ocamllabs/ocaml-ctypes,sjfloat/ocaml-ctypes,whitequark/ocaml-ctypes,whitequark/ocaml-ctypes,fdopen/ocaml-ctypes,fdopen/ocaml-ctypes,dsheets/ocaml-ctypes,ocamllabs/ocaml-ctypes,fdopen/ocaml-ctypes,dsheets/ocaml-ctypes,yallop/ocaml-ctypes,sjfloat/ocaml-ctypes,yallop/ocaml-ctypes,sjfloat/ocaml-ctypes