[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Geting the value of a top level scheme value from C
From: |
Richard Shann |
Subject: |
Re: Geting the value of a top level scheme value from C |
Date: |
Fri, 24 Jan 2014 17:49:57 +0000 |
Thanks for all the replies - sorry I didn't spot that section of the
manual (perhaps because it came under "Using modules" and I haven't
dipped my toes in that stuff).
I have it working now.
Richard
On Fri, 2014-01-24 at 12:34 -0500, Mark H Weaver wrote:
> Richard Shann <address@hidden> writes:
>
> > Given a C string that is the name of a Scheme variable what is the call
> > I need to make from C to get the value?
> >
> > That is, in the Scheme I have
> >
> > (define foo "bar")
> >
> > Then in C I want to write
> >
> > SCM bar = scm_var_c_get_val ("foo");//imaginary function name
>
> SCM bar = scm_variable_ref (scm_c_lookup ("foo"));
>
> For better efficiency, do this just once, after 'foo' has been defined:
>
> SCM foo_var = scm_c_lookup ("foo");
>
> and henceforth just do:
>
> SCM bar = scm_variable_ref (foo_var);
>
> Mark