如何在没有明确规定的情况下从dll导出模板类? [英] How do I export templated classes from a dll without explicit specification?

查看:155
本文介绍了如何在没有明确规定的情况下从dll导出模板类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含模板类的DLL。有没有明确规定的出口方式?

解决方案

由于模板代码通常在标题中,需要导出功能。也就是说,正在使用dll的库可以实例化模板。



这是让用户自由使用任何类型与模板的唯一方法,但是一种感觉它反对dll的工作方式。


I have a dll that contains a templated class. Is there a way to export it without explicit specification?

解决方案

Since the code for templates is usually in headers, you don't need to export the functions at all. That is, the library that is using the dll can instantiate the template.

This is the only way to give users the freedom to use any type with the template, but in a sense it's working against the way dlls are supposed to work.

这篇关于如何在没有明确规定的情况下从dll导出模板类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆