GCC:独立 C++ 中符号的可见性应用
因为一个关于某些符号的可见性和一个有趣的答案,链接到一篇描述不同可见性的论文类型和情况(第 2.2.4 节是关于 C++ 类的),我开始想知道独立应用程序是否需要导出符号(除了 main
- 或者是否需要) ?)。
为什么需要在独立应用程序中导出它们?
“导出符号”是“可见符号”的同义词吗?即隐藏符号是不导出的符号?
目标文件中可见符号和隐藏符号之间是否已经存在差异?或者这是在链接步骤中进行的,以便仅导出可见符号?
对于调试信息来说,符号的可见性重要吗?或者这是完全独立的,即如果我隐藏了所有符号,我也会得到一个很好的回溯? STABS/DWARF 与符号的可见性有何关系?
Because of a strange C++ warning about the visibility of some symbols and an interesting answer, linking to a paper which describes the different visibility types and cases (section 2.2.4 is about C++ classes), I started to wonder if it is needed for a standalone application to export symbols at all (except main
- or is that needed?).
Why exactly are they needed to be exported in standalone applications?
Is "an exported symbol" an synomym for "visible symbol"? I.e. a hidden symbol is a symbol which is not exported?
Do the object files already differ between visible symbols and hidden symbols? Or is this made at the linking step, so that only the visible symbols are exported?
Does the visibility of symbols matter in case for debug information? Or is that completely independent, i.e. I would also get a nice backtrace if I have all symbols hidden? How is STABS/DWARF related to the visibility of symbols?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于应用程序,您不需要这个,因为您没有 API...
可见性仅与共享对象相关。
For applications you do not need this because you do not have API...
The visibility is relevant for shared-objects only.