Hi,
I have 3 DLLs that use the same static variable from a template class instance, such as:
1st DLL:
template <typename T>
class Foo {
public:
static Foo<T>& instance() {
static Foo<T> obj;
return obj;
}
void add( ... ) {
...
}
};
template <typename T>
class Foo {
public:
static Foo<T>& instance() {
static Foo<T> obj;
return obj;
}
void add( ... ) {
...
}
};
To copy to clipboard, switch view to plain text mode
In 2nd dll, I call
Foo<myClass>::instance().add( ... );
Foo<myClass>::instance().add( ... );
To copy to clipboard, switch view to plain text mode
In 3nd dll, I also call
Foo<myClass>::instance().add( ... );
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!
Bookmarks