Problem exporting Haskell to C via a DLL in GHC 6.6

SevenThunders mattcbro at
Tue Feb 6 14:23:07 EST 2007

Simon Marlow-5 wrote:
> I wonder if you're hitting this bug:
> if so, it's slightly worrying that the same thing happens if you just link
> your 
> program directly to the DLL, rather than loading it explicitly.
> Cheers,
> 	Simon

No doubt it is the same bug.  Moreover I think even a 'direct' link to a DLL
has to call some interface code that loads the DLL in the standard way
during initialization.   Interestingly if I follow Brian's advice and remove
the shutdownHaskell call in the dllMain routine, the 'hang' goes away. 
Unfortunately, however, if I do this, then whenever I use the code inside
Matlab and decide to clear the mex function, the dll gets unloaded and
Matlab crashes.  Perhaps I can expose the unloadHaskell function in some
form for use in Matlab, or perhaps I should go with the Begin() and End()
approach suggested earlier.  I'll have to give this some thought since I use
my library both inside and outside the Matlab environment.
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