[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Using in C a function defined in guile
From: |
Mike Gran |
Subject: |
Re: Using in C a function defined in guile |
Date: |
Sun, 6 Sep 2015 16:09:06 +0000 (UTC) |
On Sunday, September 6, 2015 7:10 AM, Vladimir Zhbanov <address@hidden> wrote:
>
>
>Hi, guilers.
>
>After speaking with a man who doesn't like scheme and wants to make all
>his work in C, I wonder if there is an easy way to make the procedures
>wholly written in Guile available in C, besides any kind of 'eval'.
>Looking through the guile info I didn't found anything other.
The simplest way to implement such a thing is using
functions like scm_c_eval_string, where one creates a string
containing Guile code and executes it.
There are more complicated strategies that might be slightly faster.
One could get a variable that contains a procedure by using
scm_c_public_lookup. Then, the procedure itself can be extracted
by using scm_variable_ref. And it can be called using
The scm_call_0, scm_call_1 family of functions.
There is an example in the manual here
http://www.gnu.org/software/guile/manual/html_node/Accessing-Modules-from-C.html
-Mike