[fpc-devel]proposition changes in unit TYPES

darekM darekm at emadar.com
Mon Oct 6 18:08:42 CEST 2003


----- Original Message -----
From: "Peter Vreman" <peter at freepascal.org>
To: <fpc-devel at lists.freepascal.org>
Sent: Thursday, October 02, 2003 2:04 PM
Subject: Re: [fpc-devel]proposition changes in unit TYPES


> > I try use FPC 1.1 for Windows
> > and I have problem with some of types declarations
> > for example THandle is declared many times
> >
> > in WINDOWS.PP (base.inc) is:
> >
> >   Thandle= HANDLE = type Cardinal;
> >
> > in CLASSES (classesh.inc)
> >   THANDLE = longint;
> >
> > in SYSUTILS
> >
> > with other types like POINT RECT I have similar problems: many
collisions
> > with different types
> >
> > in 1.1RTL is unit TYPES but for me is not good
> >
> >
> > I suggest to prepare TYPES to fundamental unit
> > declares in it all common types
> > and reuse them in CLASSES, WINDOWS, UNITS
> > but TYPES must not use any unit, (delete WINDOWS, SYSUTILS from
interface)
> > with this changes can be avoid problems with misplaced types
>
> When it is such a common unit the types can also be defined in the system
> unit. But we want to stay as much as compatible as possible. And that is
> not always easy especially not with the Windows specific delphi issues
> like THandle.

not all types must be in SYSTEM,
but need to avoid two identical identifier with different types

variable MAININSTANCE in SYSTEM need be the same type like THandle

>
> For the THandle it needs to be defined in Windows unit and can then uses
> as 'type renaming' in units like Sysutils
>
> type
>   THandle=Windows.THandle

But what I can do with THandle  in CLASSES
I Lazarus FPC one times get Thandle form CLASSES , second time from
WINDOWS - that's not good

>
> But that will then need an $ifdef win32. So it needs to be investigated
> better where to define basic types so they can be used and should be
> redefined for compatibility.

my proposition is :

in unit TYPES (or in SYSTEM or another COMMON unit)

{$IFDEF WIN32}
   THandle= cardinal
{$ELSE}
  THandle=integer
{$ENDIF}

and if all unit (CLASSES, WINDOWS etc.)
uses TYPES;

and if need
  THANDLE=types.THANDLE


in SYSUTILS for other platform some times THandle is declared and some times
not, I think is not good


PS. I send this message second time, but I've not got  error

>
>
>
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel
>





More information about the fpc-devel mailing list