
30 Jul
2014
30 Jul
'14
11:53 a.m.
Klaim - Joël Lamotte wrote:
Could you clarify what would happen here:
shared_ptr<void()> p2; { shared_ptr<library> p = load_library( "mylib.so" ); p2 = get_symbol<void()>( p, "myfunction" ); } // p is destroyed
(*p2)(); // ?
The library is kept alive by p2. But if you make p2 a weak_ptr, it isn't.