[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: |
John Cowan |
Subject: |
Re: [Chicken-users] howto return a list from a c-function |
Date: |
Wed, 4 Apr 2007 17:02:35 -0400 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
felix winkelmann scripsit:
> 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.
I suggest that you use the same general machinery as c-string and
c-string*, except that instead of a single null-terminated string
you have a NULL-terminated array immediately followed by null-terminated
strings. So when passing these to C, malloc() a single block for them
(you know all the sizes in advance), and if the result type is
c-string-list*, then after copying the strings, simply cast
the char** to void* and free() it.
--
John Cowan address@hidden http://ccil.org/~cowan
Half the lies they tell about me are true.
-- Tallulah Bankhead, American actress
- [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, 2007/04/04
- 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 <=