This is the mail archive of the guile@sources.redhat.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: call a C-routine as a Scheme function?


Marius Vollmer <mvo@zagadka.ping.de> writes:

> Han-Wen Nienhuys <hanwen@cs.uu.nl> writes:
> 
> > right now I first do gh_new_procedure2_0("foo-less", foo_less), and
> > call scm_merge_x with gh_eval (gh_symbol2scm ("foo_less")). Surely
> > there must be an easier way?
> 
> You can use
> 
>     SCM func = scm_make_gsubr ("foo-less", 2, 0, 0, foo_less);


Last time I've looked at the official guile sources (november last
year :>) gh_new_procedure2_0("x", x) was an alias for 
scm_make_gsubr("x", 2, 0, 0, x);


However, I think the low level scm_* API should be used only if
you need special capabilities.  For example:

f=scm_make_gsubr ("foo-less", 2, 0, 0, foo_less, scm_scheme_guile_environment)
will create f in the guile module while

f=gh_new_procedure2_0("foo-less", foo_less)
will create f in the default user module (guile-user).


Jost

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]