If you want a singleton instance to be shared between dll and exe, put its definition in a dynamic link library instead of a static library.
In general, if you want some data to be global and unique, you should not put it in a static library.
Consider
//static lib int CurrentCounter =0; int getNextCounter() { return CurrentCounter; }
such code in a static library. In your case, if both exe and dll links against this library get their own CurrentCounter . Thus, exe and dll can have different CurrentCounter values.
source share