C++ – How to export templated classes from a dll without explicit specification

c++dlltemplates

I have a dll that contains a templated class. Is there a way to export it without explicit specification?

Best Solution

Since the code for templates is usually in headers, you don't need to export the functions at all. That is, the library that is using the dll can instantiate the template.

This is the only way to give users the freedom to use any type with the template, but in a sense it's working against the way dlls are supposed to work.