GCC: Character Visibility in Standalone C ++ Applications

Due to a strange C ++ warning about the visibility of certain characters and an interesting answer , referring to a document that describes various types of visibility and cases (section 2.2.4 is devoted to C ++ classes), I began to wonder if this is necessary for a stand-alone application to export characters in general (except main- or is it necessary?).

Why should they be exported to standalone applications?

Is the "exported character" blue for the "visible character"? That is, a hidden character is a character that is not exported?

Are object files already different between visible characters and hidden characters? Or is this done at the linking stage, so that only visible characters are exported?

Does symbol visibility mean in case of debugging information? Or is it completely independent, i.e. Do I also get a good return if I have all the characters hidden? How is STABS / DWARF related to character visibility?

+2
source share
2 answers

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

Visibility is important only for shared objects.

+4
source

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

Both PE and ELF executables can export characters as a DLL or a common object.

+2
source

Source: https://habr.com/ru/post/1745326/


All Articles