
Pavel Antokolsky aka Zigmar wrote:
On 5/6/05, Pavel Vozenilek <pavel_vozenilek@hotmail.com> wrote:
Win32 DLLs would need some support - Windows does not resolve statics when a DLL is loaded.
Either explicit registering of Singleton infrastructure from each DLL would be needed or perhaps using shared segment.
AFAIK there is no platform independent way to deal with shared memory, if that what you mean. Regarding the problem, I was thinking of some kind of way to specify the storage type manually.
For example something like in this fictional example: --- my_singleton.h class my_singleton : public boost::singleton_ex< my_singleton, static_lifetime, manual_storage > { //... }; --- my_singleton.cpp my_singleton::storage_type storage;
I'm not proposing such interface, but the idea is to allow to used to leave the storage object inside the Singleton uninitialized, and allow him to create it manually where he wants to (i.e. in shared memory or inside implementation file).
Actually, something like this already exists. class MySingleton : public singleton_ex < MySingleton, lifo_lifetime_ex < default_creation, create_using_std_allocator_ex < false, // throw if memory can't be allocated some_shared_memory_allocator < MySingleton > > > > { }; You would have to provide some_shared_memory_allocator, which would take the form of a standard allocator policy. -Jason