* eminemence:
Zara wrote:
>On 2 Nov 2006 01:50:07 -0800, "eminemence" <em********@gmail.com>
wrote:
>>Gianni Mariani wrote:
eminemence wrote:
Hi,
Is it possible to implement a Singleton without using static variables
or global variables.
Thanks.
--eminemence.
>
No.
Thats quite sad as many mobile platforms need this singleton facility
but don't support global and static vaiables.
--eminemence.
[Please, do not top-post]
Really? A C++ compiler with no possibility to define a static or
global variable? I have never found one, and I work in the embedded
field. May you tell me which one is it, to avoid it?
Zara
Symbian does not allow.
So if you compile for the emulator it will allow the static and global
declarations but when the app is finally linked for the platform it
throws an error.
So such a facility is needed just to accommodate all platforms nothing
else.
That's truly Evil(TM). I read up on it. And there seems to be no good
reason -- a lot of technical mumbo-jumbo talk about possible costs of
static data given the quite baffling decisions the Symbian OS designers
have landed on, but no discussion of the rationale of those decisions,
e.g. why application DLLs are treated the same as ordinary DLLs.
But then, I've never programmed the Symbian OS.
It seems you have three choices to get the equivalent of standard C++
functionality for static data on this OS:
* do not target the old combination EKA1 DLL (whatever "EKA1" means),
which is where this problem exists, or
* place all needed singletons or support for them in an EXE server,
or
* use thread local storage (in Symbian, Dll::SetTls() and Dll::Tls()).
<url:
http://developer.symbian.com/main/downloads/papers/static_data/SupportForWriteableStaticDataInDLLsv1.1.pdf>.
Hope this helps,
- Alf
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?