
Hi all, I need to call an Haskell module from Excel and as an exercise I started to play with the example given in GHC documentation: http://www.haskell.org/ghc/dist/current/docs/users_guide/win32-dlls.html I could build the DLL without problem but encountered a problem when using it. I created an Excel document using the dll. If I open the Excel document, do something that will trigger a function call in the DLL, then Excel will crash on Exit. On the opposite if I open the same document and changes cells not related to the function the program closes properly. I does not crash directly on the function call but later, just when I close Excel. As it crashes when closing Excel I suspect something is wrong when unloading the dll. I modified the dllMain.c code to handle the DLL_PROCESS_DETACH event but it doesn't solve the problem. } else if (reason == DLL_PROCESS_DETACH) { shutdownHaskell(); return TRUE; } I attached the code to this e-mail. I built the dll this way: ghc -fglasgow-exts -c adder.hs ghc -c dllMain.c ghc -shared -o adder.dll adder.o adder_stub.o dllMain.o Any idea on what could go wrong? Another event to handle? Thanks, Olivier.