Templates from DLL or static library problem
Hi, I was trying to store a templated function in a DLL to use it in some other app, but after
getting linker errors, I figured out that we can't put templates in DLL because the function
doesn't compile itself in the DLL, some says it's only a pattern to tell how to create new
functions, or so I heard...
While I was googling, I saw that even if templates on DLLs don't work, it should be possible
to achieve it with static libs files only, no DLL... So I made a test in a static library, but I still
got linker error. I though that static libs would simply work as if it was hidden uncompiled code. So... is there any way to have externally used templates with libs?
//Lib project source
template <class X>
void TestFunc(X var)
//Deal with var
#pragma comment(lib, "Test.lib")