This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Who have already used the new GCC option "-fvisibility=hidden" in Mingw+Msys?


Duft Markus wrote:

> Huh? Doesn't PE support symbol visibility in shared libraries etc. by
> default, and much, much much longer and better than ELF / gcc? I just
> wonder, because i'm not sure if the same stuff is meant here (I'm
> thinking of dllexport/dllimport and such...)

If you want to call dllimport/dllexport visibility then fine, but it's
not the same kind of visibility that -fvisibility=hidden refers to.

If you want to selectively expose only certain symbols on PE you do it
by declaring them __declspec(dllexport) or linking with a def file that
lists them.  In that sense the default PE visibility is already hidden
since you have to manually mark everything you want exported.  For ease
in porting software however, the PE linker enables auto-export mode if
you do neither of these things (no __declspec(dllexport) used anywhere
and no def file) which means everything is exported.

In any case, this doesn't change the fact that -fvisibility and/or
__attribute__ ((visibility ("foo")) are only relevant on ELF.  Or put
differently, the two platforms handle things in different ways so the
ELF way is not applicable to PE.

Brian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]