On May 11, 2006, at 4:04 PM, Jonathan Johnson wrote:
On May 11, 2006, at 11:29 AM, Charles Yeomans wrote:
On May 11, 2006, at 11:58 AM, Jonathan Johnson wrote:
On May 11, 2006, at 10:54 AM, Greg Gunston wrote:
Hello,
I am looking for a way of finding out what processor my app is
running on.
On PPC macs, there is no problem, it is the Intel mac that I was
wondering
about.
I have tried using the System.Gestalt call but that always
returns a G4.
Apparently under emulation, an Intel Mac will always return a G4
as the
processor.
Therefore, I am looking for a way to detect if my app is running
under
Rosetta and then I know I am on an Intel mac.
Does anyone have any ideas?
Yes:
<http://lists.apple.com/archives/perfoptimization-dev/2006/Jan/
msg00009.html>
However, I don't think anyone has ported it to REALbasic. The
declares shouldn't be too tricky, though.
They aren't; here's a port.
Function IsRosetta() as Boolean
Soft Declare Function sysctl Lib "System.framework" (p1 as Ptr,
p2 as Integer, p3 as Ptr, ByRef p4 as Integer, p5 as Integer, p6
as Integer) as Integer
Const CTL_HW = 6
Const HW_MODEL = 2
Const Null = 0
dim mib as new MemoryBlock(8)
mib.Long(0) = CTL_HW
mib.Long(4) = HW_MODEL
dim model as new MemoryBlock(32)
dim len as Integer = model.Size
dim theResult as Integer = sysctl(mib, 2, model, len, Null, 0)
Return (theResult = 0) and (len = 9 and StrComp(model,
"PowerMac", 0) = 0)
This line should probably be this instead:
return (theResult = 0) and (StrComp( model.StringValue( 0, len ),
"PowerMac", 0 ) = 0)
It probably should be,
Charles Yeomans
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>