[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] Easyffi question
From: |
Jim Ursetto |
Subject: |
Re: [Chicken-users] Easyffi question |
Date: |
Mon, 22 Dec 2008 14:24:14 -0600 |
On Mon, Dec 22, 2008 at 8:49 AM, William Ramsay <address@hidden> wrote:
> Can anyone explain to me how I convert a string to a null terminated
> c-pointer that points to a list of strings.
>
> For example the c function I need to use looks like:
>
> foo (char **str, int cnt, c-struct result)
The `sx` egg does something similar -- transforming a list of strings
into a null-terminated array of C strings. I derived a quick example
from it and attached the code.
$ csc -X easyffi -s stringlist.scm
$ csi -q -R stringlist
#;1> (my-foo (list "bar" "baz" "quux"))
string 0: bar
string 1: baz
string 2: quux
An example of the opposite transformation (null-terminated C string
array to a vector of Scheme strings) can be found in the `hostinfo`
egg under array0->string-vector.
stringlist.scm
Description: Binary data