Boost logo

Boost :

From: Martin Bonner (Martin.Bonner_at_[hidden])
Date: 2008-01-17 09:07:26


From: Tobias Schwinger
> 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.

I haven't looked at the library, but I don't understand how that works
on Windows. Won't both DLLs have their own copy of the compiled code,
and hence won't they both have their own copy of the singleton?

-- 
Martin Bonner
Senior Software Engineer/Team Leader
PI SHURLOK LTD
Telephone: +44 1223 441434 / 203894 (direct)
Fax: +44 1223 203999
Email: martin.bonner_at_[hidden]
www.pi-shurlok.com
disclaimer

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk