Boost shared pointers and MSVC++ 6.0
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 ? * Will this go away if I upgrade to MSVC++ 7 ? Thanks Henri
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.
Hi Peter,
In my case, the plugins are loaded at startup and never unloaded. I'll
try to do a small example for you to investigate.
Thanks
Henri
On 30/01/06, Peter Dimov
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 mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Henri Herscher
-
Peter Dimov