I've the following problem: I've created a DLL in C++ with a template class definition like this:
template <class T>
class myClass {
public:
//! Constructor
myClass(int size = 10);
//! Destructor
~myClass();
someAttributes ... ;
}
I want to export it so I've defined as follows:
template class __declspec(dllexport) myClass<double>;
because - I've read - in Visual C++ you can't export template but only their explicit inizialization. This way all works fine and I'm able to import the DLL in a new Visual C++ code. Now: Do I have to export an explicit instantiation for every type I need (myClass, myClass, etc)? Or is there a better way - less naive - to do that? How can I import my template class in a VB.NET project? Is there a way? Or do I've to create a marshaling structure and then convert it in my template class at runtime?
Thank you all!