Forum > Operating Systems

Determine bitness for Linux/OSX

<< < (2/2)

Shebuka:
I think that for your uses uname is just perfect, ;) system_profile can give many info (like your IP, OS version/architecture ecc.), but it's much slower.

marcov:
Note that there is a baseunix.fpuname call, you don't need to call the runtime module.

But maybe a fpuname from a 32-bit binary on a 64-bit system returns a 32-bit architecture description.

How to detect that you are not in an emulation mode is harder (Linux binaries can run in a Linux emulation mode on most BSDs)

franciscoluiz:
mr Banana  :D, 
isn't simpler something like:



--- Code: ---function TForm1.IsWindows: boolean;
begin
    {$IFDEF Windows}
         Result  := true;
    {$ENDIF}
    {$IF DEFINED(DARWIN) or DEFINED(Linux) or DEFINED(Unix)}
         Result  := false;
    {$ENDIF}
end;

function TForm1.Is32b: boolean;
begin
    {$ifdef CPU32}
         Result  := true;
    {$ENDIF}
    {$ifdef CPU64}
         Result  := false;
    {$ENDIF}
end;
--- End code ---

???

marcov:
FreeBSD:

 
[Toad] </usr/include/sys> uname -m
amd64
[Toad] </usr/include/sys> uname -p
amd64
[Toad] </usr/include/sys>

Navigation

[0] Message Index

[*] Previous page

Go to full version