NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Compiler Error C2895

'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);