
27 Jul
2004
27 Jul
'04
7:50 a.m.
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 { public: // operator-> and friends private: 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. Ben ---