Visual Studio dll export issue for class and function template instantiations

前端 未结 3 2059
心在旅途
心在旅途 2021-01-05 13:24

I am using VS2008 in win7 and g++ 4.7 in CentOS 18. The issue is only seen on Windows when I used dynamically shared library. When I convert it static library the program li

3条回答
  •  情歌与酒
    2021-01-05 14:05

    I believe this is because compiler creates specialized code for template class when the template class is first used with a specific parameters. Since compiler uses only the included header files (.h) when compling a compilation unit (.cpp files) all the tmplate code must be available in .h files. You can export specialized template classes from a dll but not the template classes themselves.

提交回复
热议问题