[ocaml-ctypes] string_of_char_ptr

Jeremy Yallop yallop at gmail.com
Mon Jan 22 07:19:40 GMT 2018


On 20 January 2018 at 23:36, john skaller <skaller at internode.on.net> wrote:
> One supplies read and write functions to views, but is there a way to get them back?

Yes, via coerce.  Given a view created as follows

   let v = view ~read:f ~write:g t

the read and write functions f and g are both available as coercions
between the view and the underlying type:

    f  ≡  coerce t v
    g  ≡  coerce v t


More information about the Ctypes mailing list