Hi Christian,

> * Define the DllMain function in C (dllMain.c):
> 
> #include <windows.h>
> #include <Rts.h>
> static char* args[] = { "ghcDll" };
> 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,NULL);
>       return TRUE;
>   }
>   return TRUE;
> }

Could you try changing the third argument of startupHaskell to be
"__init_FOO" (you can declare the symbol as extern void *).

The problem is probably that there are some static GC roots in the module
Foo that aren't being registered with the garbage collector properly.
That's what the 3rd argument to startupHaskell is for: it specifies the root
of the module tree so all the initialization code can be found.  Normally
the root of the module tree is PrelMain, but in the case of a standalone DLL
like yours, it might not be.

Cheers,
        Simon

_______________________________________________
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to