[fpc-pascal] Function to know if WIN is 32 or 64

Robert Wolfe wolfe.robwolfe at gmail.com
Wed Mar 16 04:56:06 CET 2011


On 3/15/2011 10:25 AM, Marcos Douglas wrote:
> On Tue, Mar 15, 2011 at 11:13 AM, Henry Vermaak<henry.vermaak at gmail.com>  wrote:
>> On 15 March 2011 14:05, Marcos Douglas<md at delfire.net>  wrote:
>>> Is there some function to know if the Windows is 32 or 64?
>> You can use the GetNativeSystemInfo function.  Check
>> TSystemInfo.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_AMD64 to
>> see if it's 64 bit.
> What unit?
>
>
> I've used this function in Delphi (7) and didn't work:
> function is64bitOS: boolean;
>    var
>      SysInfo: TSystemInfo;
>    begin
>      GetSystemInfo(SysInfo);
>      Result := (
>           (Sysinfo.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_AMD64)
>        or (Sysinfo.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_IA64)
>        );
> end;
>
>
> Marcos Douglas
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>

Not sure this will work for you or not, but here is what I use:

Program OSType ;

Uses SysUtils;

Begin ;

    WriteLn ;
    {$IFDEF WIN32}
        WriteLn ('This is a 32-bit version of Windows.') ;
    {$ENDIF$}
    {$IFDEF WIN64}
        WriteLn ('This is a 64-bit version of Windows.') ;
    {$ENDIF}

End.

The value returned, however, depends on whether the 32-bit compiler of 
the 64-bit cross-compiler was used.



More information about the fpc-pascal mailing list