• 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
Re: Inline symbols visibility
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Inline symbols visibility


  • Subject: Re: Inline symbols visibility
  • From: Jean-Daniel Dupas <email@hidden>
  • Date: Thu, 1 Apr 2010 12:11:22 +0200


Le 1 avr. 2010 à 11:58, Guillaume Billard a écrit :

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!



Does GCC option '-fno-default-inline' is helpful in your case ? 

-fno-default-inline
Do not assume `inline' for functions defined inside a class scope. See Options That Control Optimization. Note that these functions will have linkage like inline functions; they just won't be inlined by default. 


-- Jean-Daniel




 _______________________________________________
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: Guillaume Billard <email@hidden>
References: 
 >Inline symbols visibility (From: Guillaume Billard <email@hidden>)

  • Prev by Date: Inline symbols visibility
  • Next by Date: Re: Puzzling Analyzer output
  • Previous by thread: Inline symbols visibility
  • Next by thread: Re: Inline symbols visibility
  • Index(es):
    • Date
    • Thread