Just a short addition to my previous e-mail:

I just found an old thread which looks very similar to the problem I just described: http://www.nabble.com/GHC-6.4.1-and-Win32-DLLs:-Bug-in-shutdownHaskell--t1206938.html

I also tried to prevent the RTS from installing signal handers (it was mentionned in bug report #804 as something that could crash a dll). I put 'char *ghc_rts_opts = "--install-signal-handlers=no";' in a c file and linked it to the DLL. But it doesn't solve the problem.