« Return to Thread: Problem exporting Haskell to C via a DLL in GHC 6.6

Re: Problem exporting Haskell to C via a DLL in GHC 6.6

by SevenThunders :: Rate this Message:

Reply to Author | View in Thread


Simon Marlow-5 wrote:
I wonder if you're hitting this bug:

   http://hackage.haskell.org/trac/ghc/ticket/926

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.

 « Return to Thread: Problem exporting Haskell to C via a DLL in GHC 6.6