|
Boost Users : |
Subject: Re: [Boost-users] [boost] [shared_ptr] A smarter smart pointer proposal for dyn
From: Max (loadcom_at_[hidden])
Date: 2008-12-24 06:06:13
Hello Dotchevski,
Could you please elaborate?
Thanks.
B/Rgds
Max
----- Original Message -----
From: Emil Dotchevski
To: boost_at_[hidden]
Subject: Re: [boost] [shared_ptr] A smarter smart pointer proposal for
dynamic libraries
Date: 2008-12-24 12:37:33
As far as I can tell, the only reason your reset() appears to work is
that it is inlined in the executable. The compiler doesn't guarantee
inlining, so in general it will crash anyway.
The solution to this problem is to inject the DLL's lifetime into any
shared_ptrs obtained from that DLL; that is, make the shared_ptr keep
the DLL afloat. This can be done easily (and non-intrusively) using
shared_ptr's aliasing constructor.
Emil Dotchevski
Reverge Studios, Inc.
http://www.revergestudios.com/reblog/index.php?n=ReCode
-------------------------------------------------------------------
ÐÂÀ˿ռ䡪¡ªÓëÅóÓÑ¿ªÐÄ·ÖÏíÍøÂçÐÂÉú»î£¡(http://space.sina.com.cn/ )
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net