guile-user
[Top][All Lists]
Advanced

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

Re: Calling a scheme procedure from C


From: Mike Gran
Subject: Re: Calling a scheme procedure from C
Date: Fri, 11 Jul 2003 09:20:45 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624

When you look up a Scheme function using scm_c_lookup, it doesn't return
the procedure. It returns the variable that contains the procedure. To then get the procedure, you have to dereference the variable using scm_variable_ref.

I would call the function this way...

int main (int argc, char *argv[])
{
   SCM func_symbol;
   SCM func;
scm_init_guile(); func_symbol = scm_c_lookup("write");
   func = scm_variable_ref(func_symbol);
scm_call_1 (func, scm_int2num(10));

   exit(EXIT_SUCCESS);
}







reply via email to

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