Marco van de Voort wrote 14 lines
In our previous episode, Michael Van Canneyt said:
>> Question: what is the best way to maintain code that must compile with
>> both FPC and Delphi2007?
>> The obvious solution is to use IFDEF and define a new type, say TMyHandle.
>> FPC's libraries however take care of many platform differences. Is
>> there any better way to solve this?
>
> Shortly said: No. The Delphi API is wrong; It should also return THandle
> (as that is what Windows CreateFile returns), but probably for historical
> reasons they still use Integer.
> With the advent of 64-bit delphi, they could have cleaned up their API, but Alas...
IMHO the universal handle (for e.g. IPC related handles and file handles) is
not a portable concept to begin with.
Normally, I'd expect a TXYZHandle for each 'separate' type. With XYZ = File, Window, Lib, Module, Directory, Shmem, whatnot. This should cover most cases.
That these separate types are equal in the background is something the user need not know.
Michael.