[Top][All Lists]
[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
- [Chicken-users] howto return a list from a c-function, foobar, 2007/04/03
- Re: [Chicken-users] howto return a list from a c-function, Hans Bulfone, 2007/04/03
- Re: [Chicken-users] howto return a list from a c-function,
felix winkelmann <=
- Re: [Chicken-users] howto return a list from a c-function, foobar, 2007/04/04
- [Chicken-users] getting exact chicken version during compile-time, foobar, 2007/04/05
- Re: [Chicken-users] getting exact chicken version during compile-time, felix winkelmann, 2007/04/05
- Re: [Chicken-users] getting exact chicken version during compile-time, felix winkelmann, 2007/04/05
- Re: [Chicken-users] getting exact chicken version during compile-time, foobar, 2007/04/10
- Re: [Chicken-users] howto return a list from a c-function, John Cowan, 2007/04/04