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 protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to