Slides from a talk on GCJNI
and Haven, given at the Haskell Implementor's Meeting in Portland,
1/15/2002.
GCJNI is a library that allows Haskell to invoke Java code via the Java Native Interface (JNI). The implementation uses GreenCard to make the JNI (a C language interface) available to Haskell. GCJNI includes a few convenient features, such as:
GCJNI has been succesfully tested using both hugs98 and ghc under both Linux and Windows. Binary distributions are provided for all for of these (compiler, platform) combinations.
The Haskell types and type classes produced by the GenBindings code generator follow the same design as 'Lambada' by Erik Meijer and Sigbjorn Finne. For more details on the code produced by GenBindings, see:
GCJNI is a one way interface: It enables Haskell code to invoke Java code, but does not allow callbacks from Java to Haskell. Despite this limitation, we have found GCJNI to be very useful. For example, Haven is a purely functional Haskell library for scalable vector graphics, implemented using the Java2D renderer accessed via GCJNI.
The GCJNI library interface lacks substantial documentation beyond the basic release notes. However, much of the API is simply GreenCard'ed versions of the corresponding functions documented in the Java Native Interface (JNI). For more extensive documentation on the JNI, see:
GCJNI is currently available as a source release. We have worked hard to make it easy to configure, compile and install from sources for any platform.
Haven is a purely
functional Haskell library for scalable vector graphics, implemented
using the Java2D renderer accessed via GCJNI. Haven is also the best
demonstration of GCJNI and the GenBindings tool.
If you download GCJNI,
you are encouraged to download and try Haven, to get a feel for what
GCJNI can really do.
I would be very interested in getting feedback on GCJNI. Please send me email if you have any problems using GCJNI, or if you find GCJNI useful.