[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] Returning non-zero terminated strings from foreign c
Re: [Chicken-users] Returning non-zero terminated strings from foreign code
Sun, 4 Mar 2007 14:27:39 +0100
On 3/4/07, Peter Schuller <address@hidden> wrote:
Given some C code that malloc:s a buffer and puts some arbitrary data
(including potentially zeroes) into it, I want to convert that into a Scheme
string. Is there an idiomatic way to do this?
I had a look at foreign-lambda* to see how c-string return values are handled,
but it quickly gets pretty involved with Chicken internals that I'm not yet
ready to tackle...
The simplest solution I can come up with right now is to use
"c-pointer" as result type and "(move-memory! <ptr>
the data into a separately allocated string.