[fpc-devel] THandle and 64bit platforms

Michael Van Canneyt michael.vancanneyt at wisa.be
Tue Dec 21 09:38:19 CET 2004



On Tue, 21 Dec 2004, Florian Klaempfl wrote:

> Peter Vreman wrote:
>
> >>>That said, the RTL should also avoid confusion with the Windows/Delphi
> >>>THandle type, and introduce a cross-platform and opaque TFileHandle
> >>>type.
> >>
> >>It's text/file/file of in pascal ;)
> >>
> >>
> >>>Which will happen to be equal to THandle on 32-bit windows.
> >>>On 32-bit Linux, the definition of THandle will then also equal
> >>>TFileHandle.
> >>>
> >>>This will also take some work :-)
> >>
> >>I guess this is no solution. It makes porting delphi apps very hard.
> >>What's the problem if thandle is 64 bit on 64 bit systems? You can still
> >>store a 32 bit file handle in it.
> >
> >
> > It'll give a lot of Warnings when compiling the sources. And there is a
> > risk for rangecheck errors.
> >
> > I checked Kylix, there THandle=longword which is also incompatible with
> > our THandle=longint under Linux.
> >
> > My proposal is to rename the current THandle to TFileHandle. And add an
> > platform independent type "THandle=PtrUInt".
> > Note that this can still cause range check errors under Unix, because
> > invalid filedescriptors have (normally) value -1.
>
> Sounds good to me.

If we rename THandle to TFileHandle then we should use it where needed,
so we don't get any range check errors.

Michael.




More information about the fpc-devel mailing list