[plt-scheme] passing a buffer to the FFI
Hi there,
I am trying to wrap a MacOS api call which expects, among other
arguments, a pointer to a pre-allocated array of bytes. Upon return
the routine will fill the array with a utf-8 encoded string which I
would like to convert to a Scheme string:
CFIndex CFStringGetBytes (
CFStringRef theString,
CFRange range,
CFStringEncoding encoding,
UInt8 lossByte,
Boolean isExternalRepresentation,
UInt8 *buffer, // <----- Pre-
allocated buffer
CFIndex maxBufLen,
CFIndex *usedBufLen
);
How do I do this with the FFI? The buffer size is not know until run-
time.
Thanks in advance,
-pp