| www.delorie.com/gnu/docs/guile/guile-tut_19.html | search |
![]() Buy GNU books! | |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
If you compare learn1 to learn0, you will find that learn1 uses a new
Guile construct: the function gh_new_procedure(), and its
siblings:
/* now try to define some new builtins, coded in C, so that they are
available in Scheme. */
gh_new_procedure1_0("c-factorial", c_factorial);
gh_new_procedure1_0("c-sin", c_sin);
gh_new_procedure1_0("v-t", vector_test);
|
It is clear that gh_new_procedure() adds a new builtin
routine written in C which can be invoked from Scheme. We can now
revise our checklist for programming with libguile, so it includes
adding callbacks.
#include <guile/gh.h>
gh_enter(). This
starts up a Scheme interpreter, handling many details.
gh_enter().
gh_eval_str()
routine.
gh_new_procedure() routine.
gh_eval_str() routine.
-lguile.
I breezed by the issue of how to write your C routines that are registered to be called from Scheme. This is non-trivial, and is discussed at length in the Guile Programmer's Manual.
| webmaster donations bookstore | delorie software privacy |
| Copyright © 2003 by The Free Software Foundation | Updated Jun 2003 |