I am using RealBasic 5.5.5 and unfortunately this is not working. I get the 
same result on both the PPC and Intel Mac machines. I will keep looking at it 
to see if I can figure out what is wrong.
   
  In the meantime, another user emailed their solution that does work with RB 
5.5.5. It is as follows:
  dim s as new Shell
  s.Execute "arch"
  msgBox s.Result
  // This will either say PPC or i386

Charles Yeomans <[EMAIL PROTECTED]> 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:
>
> > 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)
End Function

Perhaps some of you could test this on your machines.

Charles Yeomans
_______________________________________________
Unsubscribe or switch delivery mode:


Search the archives of this list here:



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
_______________________________________________
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>

Reply via email to