[fpc-pascal]Integer type?

Rich Pasco pasco at acm.org
Wed Jul 31 02:54:24 CEST 2002


James_Wilson at i2.com wrote:

> I'm trying to use a Win32 API function, which is being called like this:
> 
> var
>   BytesAvail : int64;
>   BytesTotal : int64;
>   BytesFree : int64;
>   RootDir : array [1..4] of char;
> 
> GetDiskFreeSpaceEx (@RootDir,BytesAvail,BytesTotal, at BytesFree);
> 
> But when I compile I get this error:
> 
> Incompatible type for arg no. 3: Got INT64, expected LARGE_INTEGER

That's because LARGE_INTEGER is not the same as int64.  Changing your
declarations to LARGE_INTEGER made the code compile OK.

> I've checked the .pdf files for the definition of LARGE_INTEGER, but I'm 
> unable to locate that.

It's defined in the Windows unit, which is not documented in the .PDF
files.  Looking in the source C:\pp\source\rtl\win32\wininc\struct.inc
we see:

     LARGE_INTEGER = record
        case longint of
          0 : (LowPart : DWORD; HighPart : LONG);
          1 : (QuadPart : int64);
       end;

> The Win32 API Reference lists both the 2nd and 3rd 
> args as PULARGE_INTEGER, so it seems a bit odd that the 2nd arg is being 
> classified as okay while the 3rd isn't (unless the expression is being 
> evaluated right to left, in which case the 2nd arg isn't checked yet and I 
> just lied :-).

I think that you answered your own question here.

     - Rich





More information about the fpc-pascal mailing list