Dynamic linking of Haskell modules?

senganb@ia.nsc.com senganb@ia.nsc.com
Thu, 24 Jan 2002 22:10:12 -0500


I'd like to be able to dynamically load Haskell code
from a "plugin" binary file into a Haskell application,
just as I can dynamically load .so files into a C application.

Since ghci does this, I thought I could copy its implementation
but after looking into it, it's very complicated. I notice
that OCaml can do this (http://algol.prosalg.no/~malc/scaml/)

The only simple solution I can think of is to use FFI to export
the objects in the .so file as following the C interface, and then
importing them into the main Haskell application as "C functions",
but the extra marshalling is ugly.

Has anyone solved this problem?
Are there any plans to support this in the future in ghc or a
third party library?

Sengan