[Haskell-cafe] Calling Haskell from Java

Andrei de A. Formiga archimedes_siracusa at yahoo.com
Fri Jun 11 14:50:52 EDT 2004


   I need to call Haskell functions from a Java
program. In the Java side, I can use JNI, which
expects C-call functions exported from dynamically
linked libraries. So, a primitive way to get what I
want is to generate a dynamic library from Haskell
code with exported ccall functions. This brings me to
my first question:

   1) is ghc able to create dynamic libraries in all
platforms ? I searched the documentation and found
only mention of a currently unsupported way to create
DLLs in Win32, and nothing about other platforms. In
case this is not possible, one solution might be to
statically link ghc-generated code with a C dynamic
library which calls the exported Haskell functions.

   Going further from the primitive, low-level JNI x
FFI way, it would be great to automate the wrapping
and marshalling necessary, so:

   2) is there any tool to help with Haskell function
exports and data marshalling to other languages ? I
looked at HDirect but it predates the standard FFI
definition and it doesn't seem to be supported. 

   I am aware of tools to help calling Java from
Haskell, but none to go the other way around. 

   Thanks in advance for any help.

[]s, Andrei Formiga

Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.

More information about the Haskell-Cafe mailing list