Re: Alternative to gestaltSystemVersion??
Re: Alternative to gestaltSystemVersion??
- Subject: Re: Alternative to gestaltSystemVersion??
- From: Rolf <email@hidden>
- Date: Thu, 26 Jun 2003 19:46:18 +0200
Greetings,
The following class method has served me well:
+(NSString * )userFriendlyOSVersion {
NSString * result = @"";
if (floor(NSAppKitVersionNumber) <= NSAppKitVersionNumber10_1) {
// Version 10.0.x or 10.1.x
// Determine Version using Gestalt (Carbon)
SInt32 macVersion;
if (Gestalt(gestaltSystemVersion,&macVersion) == noErr) {
result = [NSString stringWithFormat:@"Version %x.%x.%x",
((macVersion & 0xff00) >> 8),
((macVersion & 0x00f0) >> 4),
(macVersion & 0xf)];
} else { // gestaltSystemVersion failed
// Ignore
}
} else {
// Version 10.2.X or later
result = [[NSProcessInfo processInfo] operatingSystemVersionString];
}
return result;
}
/Rolf
26.06.2003 18:26:50, skrev "Huyler, Christopher M" <email@hidden>:
>
Greetings ~
>
>
I'm trying to obtain the system version and although my test program executes "Gestalt(gestaltSystemVersion, (SInt32*)MacVersion)" correctly, it crashes inside my actual code:
>
>
(gdb) run -exe
>
Starting program: /stage/ino/bin/InoRpc -exe
>
[Switching to process 16740 thread 0xb03]
>
Reading symbols for shared libraries . done
>
Reading symbols for shared libraries .......................... done
>
Reading symbols for shared libraries . done
>
>
Program received signal EXC_BAD_ACCESS, Could not access memory.
>
0x00000000 in ?? ()
>
(gdb) where
>
#0 0x00000000 in ?? ()
>
Cannot access memory at address 0x0
>
#1 0x901462f0 in CFStringGetCString ()
>
#2 0x90197da8 in _CFExecutableLinkedOnOrAfter ()
>
#3 0x9013edd8 in CFDataCreateWithBytesNoCopy ()
>
#4 0x9026bcf4 in read_property_list ()
>
#5 0x9027974c in read_parse_system_version ()
>
#6 0x90279878 in _Gestalt_SystemVersion ()
>
#7 0x90279924 in InvokeSelectorFunctionUPP ()
>
#8 0x9023c684 in Gestalt ()
>
#9.....continues into my code
>
>
I don't have the source code for any of these factions so I'm at a dead-end as far as debugging is concerned. I even tried making a wrapper function to Gestalt and placing it in its own library. The problem is all of our code is windows-based ported to Unix and now being ported to
Macintosh. So we have avoided using apple frameworks until now.
>
>
Can anyone lead me in the right direction as to how I can debug this? If not, is there a way to build a library that will be completely independent of the application that links to it? If not, can you suggest an alternate way of obtaining the operating system version?
>
>
>
Thanks in advance,
>
>
~ Chris
>
_______________________________________________
>
cocoa-dev mailing list | email@hidden
>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.