unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* Guile 2.0.0 manual extensions example
@ 2011-03-25 16:50 Hans Aberg
  2011-03-25 17:25 ` Mark Harig
  0 siblings, 1 reply; 3+ messages in thread
From: Hans Aberg @ 2011-03-25 16:50 UTC (permalink / raw)
  To: bug-guile

The example in the Guile 2.0.0 manual, "Writing Guile Extensions", sec. 2.4, uses deprecated code, and does not indicate correct compiling options.

Below is a modified code, which I compiled (Mac OS X 10.6.6) using
 gcc `guile-config compile` `guile-config link` -dynamiclib -o libguile-bessel.so bessel.c

Here, the guile-config part is necessary, as the headers are now in a subdirectory. If excluded one will use the header from 1.8.

Hans


----
#include <math.h> 
#include <libguile.h> 

SCM j0_wrapper(SCM x) {
  return scm_from_double(j0(scm_to_double(x)));
}

void init_bessel() {
  scm_c_define_gsubr("j0", 1, 0, 0, j0_wrapper);
}
----




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-03-25 19:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-25 16:50 Guile 2.0.0 manual extensions example Hans Aberg
2011-03-25 17:25 ` Mark Harig
2011-03-25 19:29   ` Hans Aberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).