STL容器的二进制兼容性 [英] Binary compatibility of STL containers

查看:364
本文介绍了STL容器的二进制兼容性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我在C ++中写了一个DLL,并希望导出一个使用std :: vector参数的方法。

Let's say I write a DLL in C++ and would like to export a method which takes a std::vector parameter. Can I hope for any binary compatibility between different STL versions?

推荐答案

如果您的意思是更新版本的版本之间包含的版本编译器,是的,它可以(并将)在某些情况下工作,但你必须小心。还有一些特殊情况,例如英特尔和微软的Windows编译器 - 英特尔是非常小心保持二进制兼容性,至少当我试过它,它总是工作相当不错。

If you mean between the versions included with updated versions of the same compiler, yes, it can (and will) work in some cases, but you have to be careful. There are also a few special cases, such as the Intel and Microsoft compilers on Windows -- Intel is pretty careful to maintain binary compatibility, and at least when I've tried it, it's always worked quite nicely.

对于大多数其他情况,答案是否定的。

For most other cases, the answer is no.

这篇关于STL容器的二进制兼容性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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