6.12.3: hs_add_root crashes

Bulat Ziganshin bulat.ziganshin at gmail.com
Mon Nov 15 08:20:14 EST 2010


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:Bulat.Ziganshin at gmail.com



More information about the Glasgow-haskell-users mailing list