Re: Mac OS X Deployment Target
Re: Mac OS X Deployment Target
- Subject: Re: Mac OS X Deployment Target
- From: "Paul Sanders" <email@hidden>
- Date: Fri, 14 May 2010 14:59:39 +0100
> That's what weak linking is all about. It will fail
only when you try to use that code on 10.4, therefore such use should always be
put in a conditional statement checking for existence of the symbol (e.g. using
respondsToSelector:).
Just to say, weak linking and respondsToSelector:
are two different things. Weak linking allows you to test whether a
particular symbol (i.e. an exported function or variable) is present
on the platform you are running on, e.g.:
extern "C" void SomeFunction (void)
WEAK_IMPORT_ATTRIBUTE;
if (SomeFunction)
SomeFunction
();
respondsToSelector: serves a similar purpose for
methods by querying the tables built by the Objective-C runtime. No
symbols are involved and weak linking is not relevant here - you can use
respondsToSelector: without using weak linking at all.
On a more practical note, I build against the 10.4 SDK
since this will generate compiler warnings / errors if I inadvertenty use a
function or method not available on 10.4. Then, if I want to conditionally
call a function or method only present on later platforms I prototype the
function myself (using WEAK_IMPORT_ATTRIBUTE) or declare a category on the
relevant class respectively. This approach has trapped some potentially
unpleasant coding mistakes.
Paul Sanders.
_______________________________________________
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