6.12.3: hs_add_root crashes

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

6.12.3: hs_add_root crashes

Bulat Ziganshin-2
Hello ,

ghc 6.12.3. i use the following code to initialize my haskell dll:

extern "C" {
#include "HsFFI.h"
void __stginit_Main();

void haskell_init (void)
{
  static bool initialized = FALSE;
  if (!initialized)
  {
    initialized = TRUE;
    hs_init(NULL, NULL);
    hs_add_root(__stginit_Main);
  }
}
}

but it crashes on hs_add_root call. what may be source of problem?

without hs_add_root, it works ok, but crashes on multiple calls from C
to haskell functions, probably due to GC of "unused" code :)
 

--
Best regards,
 Bulat                          mailto:[hidden email]

_______________________________________________
Glasgow-haskell-users mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Reply | Threaded
Open this post in threaded view
|

Re: 6.12.3: hs_add_root crashes

Bulat Ziganshin-2
Hello Bulat,

Monday, November 15, 2010, 4:20:14 PM, you wrote:

>     hs_init(NULL, NULL);
>     hs_add_root(__stginit_Main);

> but it crashes on hs_add_root call. what may be source of problem?

just in minutes after presing Send i've found reason of problem. it
was due to NULLs passed to hs_init. it was crashed on hs_add_root
though that is why i haven't checked this possibility sooner


--
Best regards,
 Bulat                            mailto:[hidden email]

_______________________________________________
Glasgow-haskell-users mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users