On 20 December 2017 at 01:21, Andre Nathan <[email protected]> wrote: > Regarding ocaml-memcpy, would it have the same effect in this case if I > replaced the "ptr_opt char" parameters in the binding specifications with > just "string", thus letting ctypes make the copy? In that case, would I > still need to keep a reference to the strings on the OCaml side?
At the moment, no: if you use a string view ctypes will not keep the copy alive beyond the lifetime of the C call. But tying the lifetimes of the string and the copy together is a reasonable idea, and would match the behaviour of 'funptr', where keeping an OCaml function alive does keep the corresponding C function pointer alive. I've opened an issue to discuss/track the possibility of changing the behaviour: https://github.com/ocamllabs/ocaml-ctypes/issues/556 _______________________________________________ Ctypes mailing list [email protected] http://lists.ocaml.org/listinfo/ctypes
