
JOAQUIN LOPEZ MU?Z wrote:
----- Mensaje original ----- De: Tobias Schwinger <tschwinger@isonews2.com> Fecha: Sábado, Agosto 25, 2007 1:06 am Asunto: Re: [boost] Threadsafe singleton - questions Para: boost@lists.boost.org
Robert Ramey wrote: [...]
g) what happens if same interface used by different DLLS. Is one instance still created? Yes.
Are you sure? For instance, in Windows globals aren't merged on DLL loading, so if you've got something like:
/*** foo.hpp ***/ template<typename T> struct foo { static T* get() { T t; return &t; } };
/*** main.cpp ***/ #include "foo.hpp"
T* t1=foo<T>::get();
/*** dll1.cpp ***/ #include "foo.hpp"
T* t2=foo<T>::get();
you'll get different t1 and t2 values.
Right.
I don't see how you're able to prevent this behavior for the local static data of singleton_manager.
Not at all: As client Singletons are user classes it's the users responsibility to eventually add declspec stuff for windows. It should probably be mentioned in the docs. Thanks for the heads up. Regards, Tobias