Success Story: Cabal and Dlls

Jason Dagit dagit at
Wed Jul 26 17:33:33 EDT 2006

Ah, when I was looking for information on doing this I didn't think to
check the Visual Haskell source.  Perhaps I didn't think of it because
I have yet to get it building (but I think I've found a few things
that are probably easy to improve, for example, when the .cabal file
has a syntax error Visual Haskell doesn't report the error correctly).

If you get a chance I would appreciate it if you could look over the
code I posted on the wiki and try to improve it with your knowledge.


On 7/26/06, Krasimir Angelov <kr.angelov at> wrote:
> Hi Jason,
> I am using the same technique to build VSHaskell itself.
> Cheers,
>    Krasimir
> On 7/27/06, Jason Dagit <dagit at> wrote:
> > Hello,
> >
> > 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?
> >
> > Thanks,
> > Jason
> > _______________________________________________
> > Libraries mailing list
> > Libraries at
> >
> >

More information about the Libraries mailing list