I'm pretty sure this problem isn't new, and pretty sure it's hard to solve. Hopefully I'm wrong about the latter.

I'm trying to use the Loki::Singleton from Modern C++ Design in a program of mine.

However, I can't seem to get it to work across DLLs. I think I know why this is happening: the templated code gets instantiated in every source module, so instead of there being one global variable, each module has its own.

Obviously, this makes the Singleton very much non-single.

Is there any way to get around this behavior?