DLLs and shared libraries

Simon Marlow simonmar at microsoft.com
Mon Jun 14 11:54:57 EDT 2004

On 14 June 2004 03:03, Andrei de A. Formiga wrote:

>    I need to generate DLLs (in Windows) and shared
> libraries (in unix environments) that expose some
> Haskell functions (directly or through a C stub). My
> first option is having ghc generate the libs directly
> with the foreign export functions. But, searching
> through the documentation, FAQ, web and some part of
> the list archives, I didn't find any mention about how
> to do this. The manual mentions the capability to
> create DLLs in windows but as not working and
> unsupported. If this is possible to do in all or most
> platforms supported by ghc, I would be glad to know
> how.

You can create a DLL of Haskell code on Windows, but only of a complete
self-contained library (ie. you can't split your Haskell library into
several DLLs and link them together at runtime).

On Unix, shared libraries are more difficult.  It might be possible to
make a single .so of a Haskell library, but I'm not sure.  Alternatively
you can use Don Stewart's hs-plugin package (announced here recently).


More information about the Glasgow-haskell-users mailing list