Problem exporting Haskell to C via a DLL in GHC 6.6

Simon Peyton-Jones simonpj at microsoft.com
Wed Feb 7 03:35:16 EST 2007


Brian, Matt

| In the final analysis this seems to work fairly well.  I export an End()
| function to Matlab that calls
| shutdownHaskell().  I then create a Matlab script that calls End() prior to
| clearing the DLL out of the namespace.
| Since it appears that shutdownHaskell() can be called again,  even after
| it's already shut down without incident (at least from a few simple
| experiments) it works fairly robustly.  All that needs to be done is to
| remember to use the Matlab script as needed.

I don't think there is any reason in principle why GHC can't generate DLLs that "just work", but plainly it's deficient at the moment.  If you have now figured out what is going on, and can tell us how to improve it, do tell us.

The other thing is that we could do with more "how to" documentation about GHC and DLLs.  We have a bit here:
        http://haskell.org/haskellwiki/GHC/Using_the_FFI
Could you expand it in the light of your experience?  Even "here's how to make GHC play with MatLab" might be useful.  Might be worth pulling out a sub-page about DLLs.

I'm just keen to capture your knowledge while it's fresh!

thanks

Simon


More information about the Glasgow-haskell-users mailing list