Re: Cocoa and dead-code stripping
Re: Cocoa and dead-code stripping
- Subject: Re: Cocoa and dead-code stripping
- From: Chris Suter <email@hidden>
- Date: Mon, 2 Jul 2007 12:16:22 +1000
On 02/07/2007, at 12:05 PM, Steve Christensen wrote:
Since I have a large number of targets that share a bunch of common
code, I currently build a static library with the common bits and
then link that against all of the other targets. This works pretty
well for C++/Carbon.
I'm starting to incorporate Cocoa pieces into the shared library
and was wondering if I'll start running into code bloat if I create
full-featured classes but, for example, only end up using a couple
of methods in a particular target. Does the linker correctly
determine which methods are actually used and just including them
(and methods they call, etc.)?
No, that's impossible. There's no way for the linker to know what
methods might get called.
Or am I going to find that all class methods are included because
the linker can't tell which methods might be called?
Normal linker rules apply for when a module is included in a link
i.e. you have to reference something in a file (e.g. a class name)
before it will be included. Note that calling a method doesn't do
anything for the linker since it's fixed up at run-time.
For that reason you should isolate your code into different files/
modules as much as possible. You might need to be careful to make
sure a file that only has category methods is linked in when required.
By the way, this is the same as for Carbon/C++ since as far as I
know, the OS X linker doesn't support function level linking.
- Chris
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden