GCC:独立C ++应用程序中符号的可见性 [英] GCC: visibility of symbols in standalone C++ applications

查看:325
本文介绍了GCC:独立C ++应用程序中符号的可见性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于一个奇怪的C ++关于某些符号的可见性的警告一个有趣的答案,链接到一篇介绍不同的可见性类型和情况(部分2.2.4是关于C ++类),我开始怀疑是否需要一个独立应用程序导出符号(除了 main

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?

符号的可见性对调试信息有影响吗?或者是完全独立的,即如果我所有的符号隐藏,我也会得到一个很好的回溯?如何STABS / DWARF与符号的可见性相关?

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?

推荐答案

对于应用程序,你不需要这是因为你没有API ...

For applications you do not need this because you do not have API...

可见性仅与共享对象相关。

The visibility is relevant for shared-objects only.

这篇关于GCC:独立C ++应用程序中符号的可见性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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