[prev in list] [next in list] [prev in thread] [next in thread] 

List:       boost
Subject:    Re: [boost] News about proposed Boost.Application library
From:       Klaim_-_Joël_Lamotte <mjklaim () gmail ! com>
Date:       2014-07-30 11:59:23
Message-ID: CAOU91ON-s8=OPuHFWfOXe7+tk-JcHEF4QY4h4vAuVp4_hWg-Pw () mail ! gmail ! com
[Download RAW message or body]

On Wed, Jul 30, 2014 at 1:53 PM, Peter Dimov <lists@pdimov.com> 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
>

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic