On Feb 16, 2011, at 1:44 PM, Jerry Krinock wrote:

> I need my app to determine if *another* app is running in 32-bit or 64-bit 
> mode.  I have found that I can do that with this unix command:
> 
>   ps -ax -o flags -o command | grep TargetAppExecutableName
> 
> The 3rd least significant bit of the 'flags' is 'LP64', which is 1 for a 
> 64-bit process and 0 for a 32-bit process.
> 
> Is there a better way to do this?  I tried the processMode returned in the 
> ProcessInfoRec GetProcessInfo(), but it has no 32/64 bit distinction.

If it's actually an application, and you can target 10.6, use 
-[NSRunningApplication executableArchitecture].

Otherwise, you can use sysctl() as illustrated in this Tech Q&A 
<http://developer.apple.com/library/mac/#qa/qa2001/qa1123.html>. Somewhere in 
the kinfo_proc is the flag you're looking for.  This came up previously on 
Apple's mailing lists, so search the archives.

Regards,
Ken

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to