<div dir="ltr"><div><div><div><div><div><div>What's the proper way in ctypes to interface with the following api:<br><br></div>void read_some_data(context* ctx, void* buffer, int length);<br><br></div>where read_some_data pulls some private data out of the given opaque context and writes it into the given buffer, without blocking internally.<br>
<br></div>Ideally, I'd want something in OCaml that looks like:<br><br></div>val read_some_data : ctx -> len:int -> string<br><br></div>and the only way I see of doing this is going through bigstring first. But this means two copies: one from C -> bigstring and one from bigstring -> string.<br>
<br>Is there a better way?<br><br></div>  - Clark<br></div>