guile-user
[Top][All Lists]
Advanced

[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: Mark H Weaver
Subject: Re: Geting the value of a top level scheme value from C
Date: Fri, 24 Jan 2014 12:34:46 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

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



reply via email to

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