[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Guile 2.0.0 manual extensions example

From: Hans Aberg
Subject: Guile 2.0.0 manual extensions example
Date: Fri, 25 Mar 2011 17:50:58 +0100

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.


#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);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]