|
Boost Users : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2006-01-30 15:04:04
Henri Herscher wrote:
> Hi,
>
> I'm making heavy use of the boost shared pointers in the open source
> audio recording (voip and sound devices) project I'm
>
> developing (http://www.oreka.org).
>
> The software is cross platform (Windowns/Linux) and shared pointers
> are created in plugins and typically destroyed in other
>
> plugins or in the main program.
>
> Under linux, I haven't had any kind of problem. On windows however,
> using MSVC++ 6SP6 I have observed strange crashes that
>
> happen only in the release mode. So far I think I have been able to
> solve that doing two things (both needed or crash !):
>
> 1. Make sure all DLLs and the main program are compiled with the same
> runtime (multithreaded DLL)
> 2. Make sure all DLLs and the main program are compiled with inline
> function exapansion disabled
>
> My questions:
>
> * Is this normal ? What have other people experienced ?
No, this isn't normal. shared_ptr should work even if you don't do (1) or
(2), with one exception: the plugin that created a shared_ptr needs to be
present in memory when the last copy of this shared_ptr is destroyed
(because the creator plugin contains the destructor code.) So if you don't
unload plugins dynamically, it _should_ work. If it doesn't, try to isolate
a simple example for us to investigate.
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