This is the mail archive of the
mailing list for the Guile project.
Re: call a C-routine as a Scheme function?
- To: hanwen at cs dot uu dot nl
- Subject: Re: call a C-routine as a Scheme function?
- From: Jost Boekemeier <jostobfe at linux dot zrz dot TU-Berlin dot DE>
- Date: 15 Jul 2000 15:56:12 +0200
- Cc: guile at sourceware dot cygnus dot com
- References: <email@example.com>
Han-Wen Nienhuys <firstname.lastname@example.org> writes:
> is there an easy way to call a C-routine as a Scheme function?
wuff_wuff (SCM surname, SCM firstname)
puts ("wuff wuff");
data = gh_new_procedure2_0("wuff-wuff", wuff_wuff);
client (SCM data)
SCM dackel = gh_symbol2scm("Dackel");
SCM waldi = gh_symbol2scm("Waldi");
/* apply "Dackel Waldi" */
gh_call2(data, dackel, waldi);
But I think it's better to modularize your project, i.e. use the
snarfer instead of explicit calls to gh_new_procedure() and such.