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?


Han-Wen Nienhuys <hanwen@cs.uu.nl> writes:

> is there an easy way to call a C-routine as a Scheme function?

SCM 
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.


Jost

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