On Tue, May 31, 2011 at 1:10 AM, Pavel Tolkachev <paultolk@xxxxxxxxx> wrote: > I admit I spoke too soon, assumed before actually trying your code. After I have tried (both 1st and 2nd versions), the code gave different output to me: > > host: Loading libchild.so... > child: Constructor > host: so = 0x8db4020 > host: Unloading libchild.so... > child: Destructor > host: Unloaded. > host: (nil) Interesting. By "the code gave different output" do you mean the first version or the second one? Or both? > Which seems correct (dlclose() calls the dtor()). I used > gcc version 4.4.5 > libdl-2.12.1.so > boost 1.45.0 > Linux kernel 2.6.35-28 > libc-2.12.1.so > Mine are: gcc version 4.6.0 libdl-2.13.so boost 1.46.0 Linux kernel 2.6.38 libc-2.13.so I'm basically running a more up-to-date system than you, so it's either a) distribution induced bug (I'm on Debian) or b) a bug introduced recently. Thanks.