Detect '-fvisibility=hidden' during pre process or compile time

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello @ all,

Short question: Is there a way to detect the option '-fvisibility=hidden' during the preprocessor or the compile time, such that a warning to the user can be issued, that the library might not support it?

Long question:
We develop a header only library where we have a static structure member inside of a class. We require that this static member is seen by all operations on this class.

If our library is included with '-fvisibility=hidden' then we get multiple symbols of the same static member. We tried to fix this by declaring the static member with '__attribute__((visibility("default")))' but for members which are structs this does not seem to work.  I filed an bug report about this and got the answer, that  this is not a bug but the behavior is as desired.  (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104631)<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104631>

Since we can not change the visibility of the static member and do not want to change the visibility of the while library. (Since there is the real use case, that our library is only used in a different library and all the symbols do not need to be exposed.) We wanted to ask if it is possible to issue a warning during compile time or in the preprocessor that the  '-fvisibility=hidden' option is used in our library.

Thanks

Max




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux