[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how to wrap arrays?
From: |
Ludovic Courtès |
Subject: |
Re: how to wrap arrays? |
Date: |
Tue, 05 Sep 2006 14:35:32 +0200 |
User-agent: |
Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) |
Hi,
John Steele Scott <address@hidden> writes:
>> Now, I'd rather use a Scheme vector to represent a C vector so that it
>> wouldn't need to be traversed at "marshalling"-time.
>
> Yes, I notice a deprecated gh_scm2doubles (SCM VECTOR, double *RESULT) in
> the manual, that would have made this much simpler.
>
> Do you know the purpose of the second argument to scm_num2dbl (called
> "why")? I notice that guile 1.8 has a scm_to_double which does not have
> this second argument, but I'm stuck with 1.6 for the time being.
No, I'm not familiar with the API in 1.6.
My point was: if you use a list, then you have to traverse it in order
to produce the C array. In 1.8, there are SRFI-4 arrays which you can
directly access using a regular C pointer, which is certainly what you'd
want here.
Now, SRFI-4 isn't available in 1.6 IIRC. So you could use regular
Scheme vectors instead, but then you'd have to convert every element of
the array...
Hope this helps,
Ludovic.