Re: Determining OS at Runtime

2009-07-03 Thread Jim Correia
On Jul 3, 2009, at 1:06 PM, Steve Christensen wrote: For the case of a function, if you're deploying on 10.4 but using a 10.5 function, that function will be weak-linked so doing a runtime check is both faster and more accurate in determining whether a function exists or not. Beware that

Re: Determining OS at Runtime

2009-07-03 Thread Adam R. Maxwell
On Jul 3, 2009, at 10:06 AM, Steve Christensen wrote: For the case of a function, if you're deploying on 10.4 but using a 10.5 function, that function will be weak-linked so doing a runtime check is both faster and more accurate in determining whether a function exists or not. For a Cocoa

Re: Determining OS at Runtime

2009-07-03 Thread Steve Christensen
For the case of a function, if you're deploying on 10.4 but using a 10.5 function, that function will be weak-linked so doing a runtime check is both faster and more accurate in determining whether a function exists or not. For a Cocoa class method, you could replace the test with a call to

Re: Determining OS at Runtime

2009-07-03 Thread Mark Munz
You might also just use Gestalt: BOOL IsLeopardOrLater(void) { SInt32 vers; Gestalt(gestaltSystemVersion,&vers); return (vers >= 0x1050); } On Fri, Jul 3, 2009 at 6:59 AM, Steve Christensen wrote: > On Jul 2, 2009, at 9:56 PM, Andrew Farmer wrote: > >> On 2 Jul 2009, at 1

Re: Determining OS at Runtime

2009-07-03 Thread Steve Christensen
On Jul 2, 2009, at 9:56 PM, Andrew Farmer wrote: On 2 Jul 2009, at 16:29, Steve Christensen wrote: If you want to make sure that you don't include any "old" code in your executable when you decide to make 10.5 (for example) your base OS version, you could arrange your code like this: #if M

Re: Determining OS at Runtime

2009-07-02 Thread Andrew Farmer
On 2 Jul 2009, at 16:29, Steve Christensen wrote: If you want to make sure that you don't include any "old" code in your executable when you decide to make 10.5 (for example) your base OS version, you could arrange your code like this: #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_

Re: Determining OS at Runtime

2009-07-02 Thread Clark Cox
On Thu, Jul 2, 2009 at 4:33 PM, Dave DeLong wrote: > One way that I've seen used is to do this: > > BOOL isLeopardOrBetter = YES; > Class gcClass = NSClassFromString(@"NSGarbageCollector"); > if (gcClass == nil) { isLeopardOrBetter = NO; } Don't do that. Check for the specific feature that you wan

Re: Determining OS at Runtime

2009-07-02 Thread Steve Christensen
On Jul 2, 2009, at 4:29 PM, Steve Christensen wrote: On Jul 1, 2009, at 5:22 PM, Sherm Pendley wrote: On Wed, Jul 1, 2009 at 7:24 PM, iseecolors 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

Re: Determining OS at Runtime

2009-07-02 Thread Dave DeLong
One way that I've seen used is to do this: BOOL isLeopardOrBetter = YES; Class gcClass = NSClassFromString(@"NSGarbageCollector"); if (gcClass == nil) { isLeopardOrBetter = NO; } Cheers, Dave ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Pl

Re: Determining OS at Runtime

2009-07-02 Thread Steve Christensen
On Jul 1, 2009, at 5:22 PM, Sherm Pendley wrote: On Wed, Jul 1, 2009 at 7:24 PM, iseecolors 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 bef

Re: Determining OS at Runtime

2009-07-01 Thread Sherm Pendley
On Wed, Jul 1, 2009 at 7:24 PM, iseecolors 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 > A