Re: Determining OS at Runtime
Re: Determining OS at Runtime
- Subject: Re: Determining OS at Runtime
- From: Sherm Pendley <email@hidden>
- Date: Wed, 1 Jul 2009 20:22:15 -0400
On Wed, Jul 1, 2009 at 7:24 PM, iseecolors<email@hidden> wrote:
> I need to support 10.4 in my application, but it uses some Carbon APIs that
> are deprecated in 10.5 and I am using some new 10.5 APIs that require the
> 10.5 SDK.
>
> I am sure I have seen this before, but I have been unable to find it in the
> Archive. How do I determine at runtime which OS version I am running on?
Just check for the presence of the function you want to call. In
Xcode, set your deployment target to 10.4, so that Leopard-only
symbols will be weak-linked. Then just check the symbol for NULL
before calling it:
if (SomeLeopardFunction != NULL) {
SomeLeopardFunction();
} else {
TigerFunction();
}
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
_______________________________________________
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