Thursday, April 28, 2011

Export/Import template class

I am thankful to this really nice article which helped me to resolve issues to export/import template class instance.
I surfed a lot and couldn't found a way to export/import the whole template class. Instead we need to do explicit template instantiations to achieve this.

For e.g. instead of whole class you do it like this:
template class DLLEXPORTIMPORTAPI Container < int >;

//DLLEXPORTIMPORTAPI is __declspec(dllexport) or __declspec(dllimport)

No comments: