Re: Mac OS X Deployment Target
Re: Mac OS X Deployment Target
- Subject: Re: Mac OS X Deployment Target
- From: Christiaan Hofman <email@hidden>
- Date: Fri, 14 May 2010 16:25:15 +0200
On May 14, 2010, at 15:59, Paul Sanders wrote: > 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.
It will also work the other way around however. If you use too low a n SDK you won't get warned about deprecated API.
I think the best is to just build with various different compatible SDKs for testing purposes. And with Xcode 3.2.x that's now very easy.
Christiaan
|
_______________________________________________
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