Boost logo

Boost :

Subject: Re: [boost] News about proposed Boost.Application library
From: Klaim - Joël Lamotte (mjklaim_at_[hidden])
Date: 2014-07-30 07:59:23


On Wed, Jul 30, 2014 at 1:53 PM, Peter Dimov <lists_at_[hidden]> wrote:

> 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.
>
>
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
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk