Success Story: Cabal and Dlls

Jason Dagit dagit at
Wed Jul 26 17:13:49 EDT 2006


I would like to report that I was able to use Cabal with Visual
Haskell to build Dlls in windows.  I have posted the details about
this on the Haskell wiki (and started an extremely minimal Cabal
page).  If my content is in the wrong place, please feel free to move
it (or edit it or whatever).

The trick was to take the final HSfoo-0.1.o file generated by the
normal build process (and linked with the DllMain.c code) and tell ghc
to build a dll.  I use -package with each of the dependencies in the
cabal file to link with the needed libraries.  The resulting dll seems
to be working.

This approach is a bit hackish and while I've tried to implement as
much of it as I can in a general way it requires you to hack your
Setup.lhs file if you want to 1) build static 2) specify your exports
3) specify the name of the resulting dll.  Also, it's only been tested
on my setup which uses Visual Haskell so it may not be fit for general
consumption.  Finally, I just started really looking at Cabal
yestarday so I may not have considered things which an experienced
Cabal user would think about.

Is it possible to get this functionality built directly into Cabal so
that I tell it I want a DLL built from a library and it knows how to
make it happen?


More information about the Libraries mailing list