Skip to content

ocaml: Implement zero-copy pread and pwrite

By wrapping the C buffer into a bigarray we can allow OCaml code to
update it directly, requiring no extra string allocation or copying.

This is an API and ABI break for OCaml plugins, but note we only
guarantee the C ABI not other languages.  Old, compiled OCaml plugins
will still work.

See also:
https://discuss.ocaml.org/t/is-there-a-simple-library-that-wraps-a-c-mallocd-char-buffer/14323
https://v2.ocaml.org/manual/intfc.html#ss:C-Bigarrays-wrap

Thanks: Nicolas Ojeda Bar
Thanks: Anil Madhavapeddy
Thanks: Simon Cruanes
Edited by Richard W.M. Jones

Merge request reports