yallop / ocaml-ctypes

Library for binding to C libraries using pure OCaml
MIT License
363 stars 95 forks source link

Does using "ptr string" ever make sense? #731

Closed rlepigre closed 1 year ago

rlepigre commented 1 year ago

If a value is passed using Ctypes.string, then the OCaml string is copied into C-managed memory, and the copy is passed to C.

However, when passing a value using type Ctypes.(ptr string), I believe that no such copy happens, but I find the documentation a bit unclear on that point. If that is indeed the case, does this mean that types like ptr string or ptr (ptr string) are kind of not meaningful semantically?