Using static libs in shared libs is a recipe for disaster isn't it? It's undefined behavior.. Aren't shared libs per se undefined behavior? As far as I remember the standard does not say much about them and it happens easily "in the wild": You might use Boost.Serialization yourself but also use a 3rd-party library which does use it for its own stuff. Does it make sense to try to 'work around' it on specific implementations?
This is exactly what is happening: Observed behavior on "specific implementations" is: - Destruction order on Windows+OSX is as expected, so no problems - On linux the order gets messed up. This gets detected by a dedicated `is_destroyed` flag Hence the "work around" is to detect and handle this: ~singletonB(){ if(!singletonA::is_destroyed()) singletonA::get_instance().unregister(this); } There are only 2 problems: `is_destroyed` has a bug, breaking it and the code is actually: ~singletonB(){ BOOST_ASSERT(!singletonA::is_destroyed()); if(!singletonA::is_destroyed()) singletonA::get_instance().unregister(this); } My PR fixes both problems which is shown by tests.