GHC 6.4.1 and Win32 DLLs: Bug in shutdownHaskell?

SevenThunders mattcbro at
Mon Oct 23 21:49:02 EDT 2006

Michael Marte wrote:
> Hello *,
> before filing a bug report, I want others to comment on my problem. 
> Maybe it's my fault, not ghc's.
> I wrapped up some Haskell modules in a Win32 DLL.
> Loading the DLL dynamically (with LoadLibrary) works fine. However, 
> whether I actually use the library or not, the program (an application 
> with MFC GUI) crashes upon termination.

I was wondering if there has been any recent progress on this issue.
I have a binary windows distribution of GHC 6.5. from May  02 2006.

I created a Haskell DLL that is called from a C stub, which ultimately gets
called from Matlab.
I'm not sure if Matlab loads and unloads the DLL everytime it's called, but
it definately crashes Matlab if one tries to unload the DLL from inside
Matlab (using Matlab's clear command).  The crash occurs even if no Haskell
code is actually called from Matlab.  It suffices to simply load the Haskell
DLL and then unload it.

If you do call the DLL it will work for the first few times and then
eventually crash.  Presumably there is some kind of memory leak as alluded
to elsewhere in this thread.  I'm looking for usable workarounds here.
View this message in context:
Sent from the Haskell - Glasgow-haskell-users mailing list archive at

More information about the Glasgow-haskell-users mailing list