problem with singleton as lib

hi there !

i got a crucial problem with my singleton class. maybe there's anybody who could help me out

i implemented a singleton framework as a static lib that handles callbacks, triggers methods etc.. next to this lib, i got several dlls that access this lib.
the problem basically is that every dll allocates its own memory and includes a copy of the lib there. so, from outside (let's say, the testing app), there's not one framework, but several according to the amount of dlls that load the framework.
as there must be only one framework, i'm looking for kind of a workaround to get rid of this "feature".
i've already tried to build the singleton as a dll which then just would be linked to the other dlls, but that didn't show any positive effect either.
so in other words, is there any memory segment (which would be the heap of the current context/process) that is used by all libraries (be it static or dynamic) that i could store at least the singleton pointer in ?
a really quick solution would be to instantiate this pointer at the testing app or create a shared memory object, but these kinds of solution don't satisfy me at all.
as i'm in an absolute rush, pls come back to me as soon as possible. thank you all very much for any hint or opinion.

best regards,
j
[1374 byte] By [javatheist] at [2007-11-19 7:29:18]
# 1 Re: problem with singleton as lib
You should ideally use a COM Singleton class.
Siddhartha at 2007-11-11 0:27:18 >
# 2 Re: problem with singleton as lib
or an NT service holding a "classic" C++ singleton with a COM object to act as an interface for it. Each client will get its very own COM object but all these objects will access the same C++ object.
PadexArt at 2007-11-11 0:28:21 >
# 3 Re: problem with singleton as lib
:) :)

Or, a COM Object declared as -
DECLARE_CLASSFACTORY_SINGLETON (CMySingletonComObject);

All clients will recieve one instance of the Object.

Padex's idea is a popular option too - with those who are not comfortable with COM Objects being Singleton. :thumb:
Siddhartha at 2007-11-11 0:29:22 >
# 4 Re: problem with singleton as lib
i've already tried to build the singleton as a dll which then just would be linked to the other dlls, but that didn't show any positive effect either.

I'd be curious why this won't work. Are you planning to have a singleton shared across processes ?
kirants at 2007-11-11 0:30:27 >