
Hello,
I was fooling around with the boost::shared_ptr and boost::weak_ptr
library and dynamic libraries and I received a segmentation fault which
I do not fully understand and I am hoping someone can shed some light on
the situation.
I am playing around with having objects in a dynamic library
which are managed by shared_ptr's return weak_ptrs to the application
My problem arises when the weak_ptrs aren't destroyed before the plugin
is unloaded.
I was hoping that the weak_ptr would become invalid when the shared_ptr
it points to is unloaded but instead it causes a segmentation fault.
I'm just starting to play around with dynamic libraries and shared_ptrs
and stuff so I don't fully understand all the caveats that go with the
territory so any information would be appreciated.
Here's a small linux example which generates the error:
main.cc == Application
foo.cc/foo.hh == Dynamic Library
make sure to set LD_LIBRARY_PATH to the appropriate directory
main.cc
=======
#include <iostream>
#include