Re: Is this a bug, or am I hacking?
Re: Is this a bug, or am I hacking?
- Subject: Re: Is this a bug, or am I hacking?
- From: Allison Newman <email@hidden>
- Date: Thu, 14 Aug 2008 21:21:17 +0200
Hi Graham,
Generally speaking, string constants are only optimised within
statically linked binaries. Dynamically linked libraries, such as
dll's, so's and Mac bundles will not share constants.
Basically, under the hood, when you link together all of your object
files at build time, the linker eliminates duplicate constants to save
on memory. Obviously, with dynamically linked code, you cannot know
at link time whether or not a constant is going to be duplicated in
another code module that will be linked at runtime, so the constant
has to be included in the binary. And as it has to be included in the
binary anyhow, there is no benefit to be had in removing it at
runtime, and forcing all of the addresses in the binary to be
recalculated.
Net result, the same constant will be duplicated in two different
binary files that are linked dynamically, and hence pointers to those
constants will have different values in the two different binaries.
Hope that helps.
Alli
_______________________________________________
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