SFML 如何在其整个库中使用 std::,同时保持 DLL 安全?
我一直在读,如果 DLL 链接到与使用它的其他模块不匹配的另一个版本的运行时,并且它返回一个 std:: 对象或其类之一具有 std:: 参数,它将导致程序碰撞。那么SFML是如何做到的呢?我在任何地方都没有看到任何关于此的警告,他们大量使用 std:: ..
谢谢
I keep reading that if the DLL is linked against another version of the runtime that doesn't match the other modules using it and it returns a std:: object or one of its classes has std:: arguments, it will cause the program to crash. How does SFML do it then? I do not see any warnings about this anywhere and they heavily use std:: ..
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
理论上,不同 C++ 运行时之间的互操作性无法保证,甚至同一编译器的不同版本之间也是如此。 SFML 似乎发布了
VC++ 2005、VC++ 2008 和 MinGW 的单独 Windows 库下载。
但如果说混合不同的运行时会导致崩溃,那就有点夸张了。如果编译器供应商没有保持某种合理水平的互操作性(例如,在主要编译器版本之间的小补丁之间),他们的客户就会逃跑,或者至少如果他们有一点理智的话他们会这么做!
In theory, there are no guarantees of interoperability between different C++ runtimes, not even between different releases of the same compiler. And it seems that SFML releases
separate Windows library downloads for VC++ 2005, VC++ 2008, and MinGW.
But to say that mixing different runtimes will cause a crash is an exaggeration. If compiler vendors didn't maintain some reasonable level of interoperability (for example, between minor patches to major compiler releases), their customers would run for the hills, or at least they would if they had a lick of sense!