Boost logo

Boost Users :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-06-18 06:12:46


"Phil Nash" <phil.nash.lists_at_[hidden]> wrote in message
news:00fc01c21621$d3e29950$700a0c0a_at_TimeMachine...
> > > > I don't know about MS, but in Borland a common source of DLL
interface
> > > > problems is
> > > > not using a common (shared) memory manager.
> > > >
> > >
> > > Thanx Craig, that turned out to be the problem for VC++ as well.
> >
> > Yep, but shared_ptr is supposed to work in this case, in theory. ;-)
I'll
> > look into this. Any more information that can help me find the problem?
>
> It works if the destructor of the object being held in the shared_ptr or
> scoped_ptr is not implemented inline in the header file. If it *is* then
> destruction is called in the context of whoever is currently holding the
> smart pointer to it at the time - and if that is across a dll boundary
from
> the creation site then *bang* (if you have mismatched runtime models).

I think this only holds if the raw pointer is passed out of the DLL where it
was created before the shared_ptr<> gets a chance to take ownership. The
cure: don't pass raw pointers around.

-Dave


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