From: Tobias Schwinger (tschwinger_at_[hidden])
Date: 2008-01-17 04:20:13
Johan Nilsson wrote:
> Tobias Schwinger wrote:
>> Edson Tadeu wrote:
>>> Does it support a single singleton across multiple DLL's? I.e.,
>>> singleton S is accessed the first time by DLL A (and is created),
>>> then it is accessed by DLL B. Does DLL B create a new instance of
>>> singleton S for it, or can it use the one created by DLL A as a
>>> truly global singleton?
>> Yes. See the documentation for details.
> Unless you have updated the documentation since the announcement, I think it
> would be a good idea to explain this in better detail. An 'implementation
> details' section would be a great addition to the document.
OK, I'll take this as the "how does it work"-question :-).
It's actually quite easy: The macros introduce a member function that is
defined in compiled code and used to access the Singleton. This way, all
code to manage a Singleton's lifetime is in one place.
The SubsystemTag works even simpler: It just changes the symbol names so
multiple independent "families" of Singltons can coexist in one program.
It is important, because otherwise the main program's infrastructure may
"adopt" a Singleton of a dynamic library which will crash the program if
the library got unloaded before termination.
Boost list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk