Hi,

I have 3 DLLs that use the same static variable from a template class instance, such as:

1st DLL:
Qt Code:
  1. template <typename T>
  2. class Foo {
  3.  
  4. public:
  5.  
  6. static Foo<T>& instance() {
  7. static Foo<T> obj;
  8. return obj;
  9. }
  10.  
  11. void add( ... ) {
  12. ...
  13. }
  14.  
  15. };
To copy to clipboard, switch view to plain text mode 

In 2nd dll, I call

Qt Code:
  1. Foo<myClass>::instance().add( ... );
To copy to clipboard, switch view to plain text mode 


In 3nd dll, I also call

Qt Code:
  1. Foo<myClass>::instance().add( ... );
To copy to clipboard, switch view to plain text mode 


In linux things work fine. The Foo<myClass>::instance() contains the 2 items I "add"

However, in Windows, they don't know each other. It appears each has their own "instance". How can I export the instance so all DLLs share it?

Thanks!