On Oct 30, 2007, at 1:46 PM, Alexander von Below wrote:
Am 30.10.2007 um 21:13 schrieb Rich Siegel:
On 10/30/07 at 1:47 PM, email@hidden (Steve Mills) wrote:
What does the following warning mean? I have a few hundred of them
showing up in Xcode 3.0:
I ran into this during Leopard testing a while back, and received the following helpful response from an Xcode team member:
Me too.
Usually these are inconsistent use of various visibility controls.
I do not see any visibility controls. Maybe I am ingnorant, but I was not able to find anything about this in the gcc manuals. Could someone point me to "visibility for dummies", so I can see what exactly is causing this in my code?
The visibility controls are threefold:
• Directives in source code. These take the form of
__attribute__((visibility("hidden"))) void MyFunction2() {}
and designate that the following symbol is to be hidden from linkage with other compilation units at link time.
• Pragmas in source code. These take the form of
#pragma GCC visibility push(default)
void g() { }
void h() { }
#pragma GCC visibility pop
and designate that all symbols declared in the #pragma section will have the designated visibility at link time.
In both above cases, "default" refers not to a particular visibility, but to the default visibility as passed on the command line by Xcode build settings.
• Command-line flags controlled by Xcode build settings
The gcc flag -fvisibility=hidden sets the default visibility of all symbols compiled in that pass. It can be set per-file in the Compiler Flags, or set for an entire target or project with the Symbols Hidden by Default build setting.
• Ex-post-facto stripping
Even if you have declared a symbol to be visible with an __attribute__ or #pragma and are not hiding it by default with the build setting, a symbol may still be rendered unexported by stripping of the binary, either with use of an Exported Symbols File or Unexported Symbols File, or by use of Strip Linked Product and Strip Style.
Apart from the bug Rich mentioned, one way to get the above error is to have a symbol declared "default" visibility in a heaer file, then #include that header from two different source files, one built with -fvisibility=hidden and one not. That gets conflicting definitions for the "default" visibility for that symbol.
Chris