Subject: Re: bug#21587: Mac: Segfault when unloading shared object linked to libguile

From: Andy Wingo <[email-masked]>
Date: Fri, 24 Jun 2016 14:32:48 +0200

On Tue 29 Sep 2015 20:21, Wilhelm Schuster <[email-masked]> writes:

> The basic run down: When I try to unload (using dlclose() ) a shared
> object that is linked to libguile after calling scm_init_guile() OR
> scm_with_guile(), a Segfault is triggered.

Hummmmmmmmmmmm!  Well, so this is quite tricky.  Loading Guile loads
Guile which might start threads (some helper threads behind the scenes
for finalization (see section on scm_set_automatic_finalization_enabled
in tha manual), perhaps a thread to listen for signals, and then the
garbage collector that we use (libgc) might start parallel marking
threads (though you can control that parameter too).

Guile doesn't really provide an interface to allow it to shut down
cleanly and I don't know if it can.  (I guess it could.)  However it
would take quite some amount of work and I don't see us doing it any
time soon.  In any case simply trying to dlclose() is never likely to
work, as you aren't synchronizing with Guile itself.

Sorry for the bad news!

Andy