From: Ben Young (ben_at_[hidden])
Date: 2004-07-27 02:50:17
On Tuesday 27 July 2004 07:21, Vladimir Prus wrote:
> Do you mean that reference counting should be done by DLL itself? Why not:
> template<class T>
> class plugin_ptr
> // operator-> and friends
> T* m_ptr;
> shared_ptr<dll_handle> m_dll;
> So, 'dll' won't be deleted until all plugins which use it are dead.
The way we do that at my company is that all objects returned by a plugin are
held my a shared_ptr which has a custom deleter which decrements a ref count
on the library itself.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk