• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Inline symbols visibility
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Inline symbols visibility


  • Subject: Inline symbols visibility
  • From: Guillaume Billard <email@hidden>
  • Date: Thu, 1 Apr 2010 11:58:16 +0200

Hello,

We're using GCC 4 visibility feature, by compiling our app with -fvisibility=hidden and adding __attribute__((visibility("default"))) as a macro for symbols that need to be exported.
After reading Apple's guide and the GNU wiki about visibility, I thought that making a class visible made everything inside it visible as well.
But when compiling one of our libs with -O3, a method is not exported even though the class it belongs to uses the right attribute.
This method is defined inside the class definition, so I'm guessing that the compiler inlined it and that's why it wasn't exported.

I found this thread where it seems that the same behavior occurred:
http://lists.apple.com/archives/xcode-users/2005/Jul/msg00609.html.

Adding the "default" visibility attribute to the inline method solved the problem.
If I'm not mistaken, the compiler gets to decide wether to inline methods or not, even when they're defined out of their class definition.
It appears that it can inline methods for classes that use  __attribute__((visibility("default"))), but I don't know if it can do the same for out-of-class methods. I'm hoping not.
I'd like to know if adding the attribute to a method of a visible class whenever it doesn't get exported is the right approach.
It kind of turns the granularity of the visibility from class to method.
The only other solution that I can think of is to define the method out of the class but as I said I don't know if it's supposed to work all the time, and in my case it's not a practical thing to do.

Thanks!


Guillaume

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Inline symbols visibility
      • From: Andreas Grosam <email@hidden>
    • Re: Inline symbols visibility
      • From: Jean-Daniel Dupas <email@hidden>
  • Prev by Date: Puzzling Analyzer output
  • Next by Date: Re: Inline symbols visibility
  • Previous by thread: Re: Puzzling Analyzer output
  • Next by thread: Re: Inline symbols visibility
  • Index(es):
    • Date
    • Thread