views:

183

answers:

2

Hi,

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?

+3  A: 

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

The visibility is relevant for shared-objects only.

Artyom
So an application doesn't have exported symbols? And it doesn't matter what visibility I specify for the debugging symbols?
Albert
@Albert Visibility is just an ELF option for ordinary symbols. The symbol remains where it is, it is just not linked with others even if they are same. Debugging information is totally different information and not connected to it.
Artyom
Ah, thanks for clarifying this out.
Albert
A: 

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

Both PE and ELF executables can export symbols, just like a DLL or Shared Object.

Jeffrey Walton