AW: Bug in GHC's Garbage Collection?
Lescher Christian
christian.lescher at icn.siemens.de
Tue Oct 31 04:52:55 EST 2000
With "__init_Foo" instead of "__init_FOO" compilation was possible. But the problem with the Garbage Collection is still there. What can I do?
Cheers, Christian
> -----Urspr> üngliche Nachricht-----
> Von: Lescher Christian
> Gesendet am: Dienstag, 31. Oktober 2000 07:24
> An: 'Simon Marlow'; glasgow-haskell-bugs at haskell.org
> Cc: 'Christian Lescher'
> Betreff: AW: Bug in GHC's Garbage Collection?
>
> Hi Simon,
>
> Could you try changing the third argument of startupHaskell to be
> "__init_FOO" (you can declare the symbol as extern void *).
>
> [Lescher Christian] Okay, I changed the dllMain.c to:
>
> ...
> extern void __init_FOO;
> ...
> 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,__init_FOO);
> return TRUE;
> ...
>
> << Datei: dllMain.c >>
>
> But when compiling this, I get the following error:
>
> sh-2.04$ ghc -c -static dllMain.c
> dllMain.c:18: `__init_FOO' has an incomplete type
>
> My second trial was to declare "__init_FOO" like this:
>
> EXTFUN(__init_FOO);
>
> Then the compilation of dllMain.c works fine, but when linking it ("ghc ... --mk-dll ..."), there is another error message:
>
> dllMain.o(.text+0x18):ghc1052.c: undefined reference to `__init_FOO'
>
> 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.
> [Lescher Christian]
>
> I'm sorry for using the 3rd argument in the wrong way ... It's my fault, not GHC's bug.
> What's the root's name when there is more than one function in a DLL?
>
> Cheers, Christian
>
More information about the Glasgow-haskell-bugs
mailing list