|
Boost : |
Subject: Re: [boost] [shared_ptr] A smarter smart pointer proposal for dynamic libraries
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2008-12-25 10:49:49
On Thu, Dec 25, 2008 at 3:06 AM, J.D. Herron <jotadehace_at_[hidden]> wrote:
> My reply was poorly worded. Of course the compiler may choose to generate
> function calls for an instantiated type and could do so for both the
> executable and dynamically loaded dll in my simple example. Fine. My point
> is that even if that were the case it doesn't hurt my simple smart pointer
> alternative because the function pointers that might exist in the factory
> are not carried over into the executable and therefore would pose no
> problem
In general, the caller needs to get the function pointers, or vtables,
or boost::function objects, or whatever else I might have stuffed in a
custom deleter, not to mention ("a pointer to") the destructor of the
pointee. Thus, the DLL must remain loaded.
(Note that even if the factory doesn't return a shared_ptr with custom
deleter, the fact that it returns a shared_ptr means that it reserves
the right to do so occasionally or in a future implementation.)
Emil Dotchevski
Reverge Studios, Inc.
http://www.revergestudios.com/reblog/index.php?n=ReCode
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk