jeudi 9 juin 2016

Singleton class in a static library

Suppose I have a singleton class S in a static library, this could be linked with the other dynamic libraries D1 D2 D3,

So from what I understand the class S will have a separate instance in each D1, D2 and D3 and this would be true even if it is not a singleton (like global)

Is there any way to prevent multiple copies of class S? I cannot put the singleton S in another Dynamic library.

                 Executable
                /   |   \   \
              D1    D2  D3  D4 
               |    |   |
               S    S   S

Aucun commentaire:

Enregistrer un commentaire