Boost logo

Boost :

Subject: Re: [boost] "peer reviewed" - Rights and responsibilities of maintainers
From: Alexander Grund (alexander.grund_at_[hidden])
Date: 2018-10-18 08:57:10


> 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.




Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk