• 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: Organizing .h and .m files.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Organizing .h and .m files.


  • Subject: Re: Organizing .h and .m files.
  • From: glenn andreas <email@hidden>
  • Date: Fri, 5 Oct 2007 15:35:03 -0500


On Oct 5, 2007, at 3:18 PM, Greg Guerin wrote:

Nelson Santos wrote:

Yeah, I know.  But I didn't want to add a whole library if I only
wanted one of the classes included in my app.

If you create your static library from multiple translation units, then
when you link to it, only the units you actually use will be pulled into
your executable. Static libs aren't necessarily monolithic all-or- none
constructions. A typical static lib is an "archive" of separately linkable
object-files, usually arranged in dependency order for single-pass symbol
resolving.



Note that this is, at best, problematic with Objective-C.

Basically you need to link static libraries with a flag telling the linker to pull everything Objective-C related in, because it has no good way to figure out exactly what methods/classes are going to be referenced and which ones aren't. For example, if you declare a category on NSString, how is the linker going to know if you need it or not? Just because your code includes a selector "foo" doesn't mean that it will call the method foo on an NSString, as opposed to foo on something else...

For the same reason, it's not practical to try to do dead code stripping on Objective-C methods...



Glenn Andreas email@hidden
<http://www.gandreas.com/> wicked fun!
quadrium | flame : flame fractals & strange attractors : build, mutate, evolve, animate




_______________________________________________
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: Organizing .h and .m files.
      • From: Nelson Santos <email@hidden>
References: 
 >Re: Organizing .h and .m files. (From: Greg Guerin <email@hidden>)

  • Prev by Date: Re: Organizing .h and .m files.
  • Next by Date: Subversion and XCode 2.4.1
  • Previous by thread: Re: Organizing .h and .m files.
  • Next by thread: Re: Organizing .h and .m files.
  • Index(es):
    • Date
    • Thread