[PRL] Calling Functions Written in Java from Scheme?
Felix S Klock II
pnkfelix at ccs.neu.edu
Tue May 1 14:28:47 EDT 2007
On May 1, 2007, at 2:05 PM, Christine Hang wrote:
> Is there a way to call functions written in Java from Scheme?
There are a number of Scheme implementations written in Java that
provide reasonable FFI's to communicate with Java. So, assuming that
you haven't tethered yourself to the feature set a particular Scheme
implementation, you could use one of them. (Of course, if your main
Scheme program is of significant size, then you are probably relying
on features its implementation provides beyond RnRS. But I digress.)
The JVM-based Scheme implementation I have the most experience with
is Kawa. Its not 100% R5RS-compliant (at least not by default), but
it was reasonably fast and provided a suitable environment for
exploring Java libraries interactively.
http://www.gnu.org/software/kawa/
In particular this section of its manual documents how to call Java
methods from Scheme:
http://www.gnu.org/software/kawa/Method-operations.html
An alternative is JScheme, whose Javadot notation for its FFI is
popular.
http://jscheme.sourceforge.net/jscheme/doc/javadot.html
I do not have personal experience using JScheme; I only know it
because the Javadot notation was selected for use in Common Larceny.
(There are many other JVM-based Scheme systems; SISC, Bigloo, ...)
-Felix
More information about the PRL
mailing list