V
Vyacheslav Lanovets
Hi All!
In native mode I can export class template from a DLL this way:
template <typename T> class TSuperType
{
public:
T doSomething();
};
....
template class __declspec (dllexport) TSuperType<int>;
And I can import it this way in another module:
template class __declspec (dllimport) TSuperType<int>;
But when I enable CLR support on both modules and recompile I get LNK2028
and LNK2019 errors about missing doSomething(). I don't have any explicit
calling convention anywhere and _both_ modules are compiled with /CLR. What
can I do?
TestCLRXportTemplates.obj : error LNK2028: unresolved token (0A00001C)
"public: int __thiscall TSupertType<int>::getData(void)"
(?getData@?$TSupertType@H@@$$FQAEHXZ) referenced in function "int __cdecl
wmain(int,wchar_t * * const)" (?wmain@@$$HYAHHQAPA_W@Z)
TestCLRXportTemplates.obj : error LNK2019: unresolved external symbol
"public: int __thiscall TSupertType<int>::getData(void)"
(?getData@?$TSupertType@H@@$$FQAEHXZ) referenced in function "int __cdecl
wmain(int,wchar_t * * const)" (?wmain@@$$HYAHHQAPA_W@Z)
C:\Documents\Visual Studio
2005\Projects\Test\TestCLRXportTemplates\Debug\TestCLRXportTemplates.exe :
fatal error LNK1120: 2 unresolved
In native mode I can export class template from a DLL this way:
template <typename T> class TSuperType
{
public:
T doSomething();
};
....
template class __declspec (dllexport) TSuperType<int>;
And I can import it this way in another module:
template class __declspec (dllimport) TSuperType<int>;
But when I enable CLR support on both modules and recompile I get LNK2028
and LNK2019 errors about missing doSomething(). I don't have any explicit
calling convention anywhere and _both_ modules are compiled with /CLR. What
can I do?
TestCLRXportTemplates.obj : error LNK2028: unresolved token (0A00001C)
"public: int __thiscall TSupertType<int>::getData(void)"
(?getData@?$TSupertType@H@@$$FQAEHXZ) referenced in function "int __cdecl
wmain(int,wchar_t * * const)" (?wmain@@$$HYAHHQAPA_W@Z)
TestCLRXportTemplates.obj : error LNK2019: unresolved external symbol
"public: int __thiscall TSupertType<int>::getData(void)"
(?getData@?$TSupertType@H@@$$FQAEHXZ) referenced in function "int __cdecl
wmain(int,wchar_t * * const)" (?wmain@@$$HYAHHQAPA_W@Z)
C:\Documents\Visual Studio
2005\Projects\Test\TestCLRXportTemplates\Debug\TestCLRXportTemplates.exe :
fatal error LNK1120: 2 unresolved