SevenThunders wrote:
Before I post this as a bug, I thought I'd check to make sure I'm not
doing something wrong.
BOOL
STDCALL
DllMain
( HANDLE hModule
, DWORD reason
, void* reserved
)
{
if (reason == DLL_PROCESS_ATTACH) {
/* By now, the RTS DLL should have been hoisted in, but we need
to start it up. */
startupHaskell(1, args, __stginit_Bad);
return TRUE;
}
if (reason == DLL_PROCESS_DETACH) {
shutdownHaskell();
return TRUE;
}
return TRUE;
}
The above *may* be the problem: it is unsafe to do anything in DllMain that
may involve loading a DLL, (which therefore includes a lot of the standard
platform sdk functions, some of which Haskell may need to use to
start/sthurdown) because the order in which DllMain is called when Windows
loads/unloads DLLs is undefined - see platform sdk docs for more info.
Instead of trying to start/shutdown Haskell from DllMain, I'd export a
Begin() and End() function from the DLL and explicitly call these from your
application's main().
Hope this helps,
Brian.
--
http://www.metamilk.com
_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users