On Wed, Jul 30, 2014 at 1:53 PM, Peter Dimov
Klaim - Joël Lamotte wrote:
Could you clarify what would happen here:
shared_ptr
p2; { shared_ptr<library> p = load_library( "mylib.so" ); p2 = get_symbol ( p, "myfunction" ); } // p is destroyed (*p2)(); // ?
The library is kept alive by p2. But if you make p2 a weak_ptr, it isn't.
Ok I was confused by the the shared_ptr constructor you pointed but now I see (I didn't knew this, it's useful!) Thanks for your patience. Indeed the use cases I was describing is fulfilled if I use weak_ptr (and wrap it in some ways to make it behave as I want when the library is not alive anymore and it is accessed).
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/ mailman/listinfo.cgi/boost