On Tue, May 31, 2011 at 7:44 AM, Ian Lance Taylor <iant@xxxxxxxxxx> wrote: > David Hagood <david.hagood@xxxxxxxxx> writes: > >> On Sun, 2011-05-29 at 01:32 +0200, J wrote: >>> // compile with: g++ -ldl host.cpp -o host >> <snip> >>> // compile with: g++ -lboost_signals child.cpp -shared -fPIC -o libchild.so >> >> Of course, this isn't really a GCC question, but a libc/binutils >> question, so you may do better over on that list. > > To be precise, this is a libc question. It is not a binutils question. > This is a question about the dynamic linker and libdl, both of which are > part of libc on a typical Unix or GNU/Linux system. I've managed to track this issue down. (Silly me, I should have tried this sooner.) It seems this *is* a bug in GCC: $ g++-4.4 -lboost_signals child.cc -shared -fPIC -o libchild.so $ ./host host: Loading libchild.so... child: Constructor host: so = 0x85ab020 host: Unloading libchild.so... child: Destructor host: Unloaded. host: (nil) $ g++-4.6 -lboost_signals child.cc -shared -fPIC -o libchild.so $ ./host host: Loading libchild.so... child: Constructor host: so = 0x8b34020 host: Unloading libchild.so... host: Unloaded. host: (nil) child: Destructor Should I file a bug report?