chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] howto return a list from a c-function


From: felix winkelmann
Subject: Re: [Chicken-users] howto return a list from a c-function
Date: Wed, 4 Apr 2007 07:26:05 +0200

Hi!

Since this (returning string lists) appears to be requested
fairly often, I have added a new foreign result type to
the current darcs head (2.607): the type "c-string-list"
expects a "char **" results and returns a list of strings.
The string array returned from C should be terminated
by a NUILL pointer.

You can access the retrieval procedure directly, it's
called

(##sys#peek-c-string-list POINTER COUNT)

POINTER should be a foreign pointer object, COUNT
should be either #f (list is terminated by NULL) or a fixnum,
which gives the number of strings to extract.

I will try to come up with a usable implementation for the
other direction, passing string-lists to C, but I'm not sure
where to allocate the storage for the list, and what to do
for callbacks that might trigger GC. Perhaps allocate
an array via alloca()? Any ideas are welcome.


cheers,
felix




reply via email to

[Prev in Thread] Current Thread [Next in Thread]