Example1.cc is has a work-around -- main() needs to call scm_init_guile() or scm_with_guile().  If this is done, the problem goes away.

The problem with example1 is that the first thread to initialize guile is eventually destroyed. However, the first thread to call guile never ever sets "needs_unregister" in libguile/threads.c and thus, bdwgc never finds out that this thread no longer exists. Sooner or later, bdwgc touches this non-existent thread, and crashes.

If its OK to initialize guile for the first time ever in a transient thread, then there's a bug in guile; else there's a bug in the example.

I'm now looking into example2.

--linas