guile-user
[Top][All Lists]
Advanced

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

Re: Newbie question regarding REST arguments from C.


From: Mike Gran
Subject: Re: Newbie question regarding REST arguments from C.
Date: Fri, 11 Jun 2004 06:56:10 -0700 (PDT)

--- Noufal Ibrahim <address@hidden> wrote:
> 
>       The problem is that the function needs to accept a REST
> argument
>       that contains the indices of the array. How do I do this? 
> 
>      
>
scm_uniform_vector_ref(scm_c_lookup("foo"),SCM_LIST2(SCM_MAKINUM(5),SCM_MAKINUM(5)));
>       errors out saying 
>       ERROR: Wrong number of arguments to uniform-vector-ref

You're misreading the meaning of the error message.  You've called the
function correctly and made the list correctly.  Its just that
scm_c_lookup doesn't return what you think it does.

The function scm_c_lookup() doesn't return the array itself.  It
returns the variable that contains the array.  From there you need to
use scm_variable_ref() to dereference the variable to get its contents.
 Its kind of like a pointer vs. the data that the pointer points to.

It says you've got "Wrong number of arguments" because the variable
that scm_c_lookup returns isn't an array, it is a single variable. 
Only its contents is an array.

Attached please find an example.


        
                
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 

Attachment: main.c
Description: main.c

Attachment: data.scm
Description: data.scm


reply via email to

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