11.3. Creating a DLL

Making libraries into DLLs doesn't work on Windows at the moment (and is no longer supported); however, all the machinery is still there. If you're interested, contact the GHC team. Note that building an entire Haskell application as a DLL is still supported (it's just inter-DLL Haskell calls that don't work). Sealing up your Haskell library inside a DLL is straightforward; compile up the object files that make up the library, and then build the DLL by issuing a command of the form:

ghc ––mk-dll -o foo.dll bar.o baz.o wibble.a -lfooble

By feeding the ghc compiler driver the option ––mk-dll, it will build a DLL rather than produce an executable. The DLL will consist of all the object files and archives given on the command line.

To create a `static' DLL, i.e. one that does not depend on the GHC DLLs, use the -static when compiling up your Haskell code and building the DLL.

A couple of things to notice: