Success Story: Cabal and Dlls

Simon Marlow simonmarhaskell at gmail.com
Thu Jul 27 07:31:27 EDT 2006


Jason Dagit wrote:
> Perhaps I spoke too soon.
> 
> I loaded my dll into a C++ application (where it will be used) and as
> soon as I hit FreeLibrary() my program crashes.  I tried adding
> shutdownHaskell() to the dll and it gets a little better.  It goes
> from crashing all the time to crashing some of the time.  I wrote a
> small test program in C++ where I added a 100 iteration loop that just
> loads and unloads the Dll.  It seems to crash my program usually
> before getting to the double digits.  I noticed the memory usage seems
> to climb quite a bit too.
> 
> I found this thread:
> http://www.haskell.org//pipermail/glasgow-haskell-users/2006-March/009771.html 
> 
> I don't see a solution listed there.  This is a show stopper for me.
> If I can't get Dlls working reliably then I won't be using haskell :(
> So I'm looking for just about any reasonable solution.

We do have some bugs with loading and unloading DLLs multiple times.  I believe 
I've fixed the worst bugs (the ones that cause direct crashes), but there are 
apparently some resource leakages too.

The version of GHC you have with Visual Haskell doesn't have the fixes 
unfortunately, so you would have to drop VH and use a GHC snapshot or wait until 
we can put out a new Visual Haskell (no timeframe for that as yet).

See these:

http://hackage.haskell.org/trac/ghc/ticket/803
http://hackage.haskell.org/trac/ghc/ticket/804
http://hackage.haskell.org/trac/ghc/ticket/753
http://hackage.haskell.org/trac/ghc/ticket/747
http://hackage.haskell.org/trac/ghc/ticket/716

You should probably talk to Lennart Augustsson 
<lennart.augustsson at credit-suisse.com> who is using DLLs quite heavily (and 
submitted most of those bug reports).

Cheers,
	Simon


More information about the Libraries mailing list