'function' : cannot explicitly instantiate a function template that has been declared with dllimport
Example
template<class T> void mf(T) {...
}; template void __declspec(dllimport) mf<int>(int); //error
The following code works if the function can be inlined. Otherwise the function in the DLL is called and the error occurs:
template<class T> void mf(T) {... } inline template void __declspec(dllimport) mf<int>(int);