[fpc-pascal] Typechecking problem porting from D7

Florian Klaempfl florian at freepascal.org
Mon Sep 15 23:06:24 CEST 2008

Frank de Groot / Rent-a-Geek schrieb:
> Hi guys - after a decade using Delphi, I finally switched to FPC! I like 
> it a lot, so far.

Actually Lazarus ;)

> Porting some code, I am stuck with something that looks trivial, 
> however, and I hoped someone here can help out?

As far as I can see from the mail, you're using a windows api function 
with an lcl type (the lcl redefines a lot of windows types and provides 
some also on other OSes).

Just try:
var LBrush : Windows.TLogBrush;
ExtCreatePen( PS_COSMETIC or PS_ALTERNATE,1, LBrush,0,nil );

> (If this is the wrong place, sorry!)
> The following code, compiled to a  WIN64 target gives a compile time 
> error: TeCanvas.pas(1479,62) Error: Incompatible type for arg no. 3: Got 
> "tagLOGBRUSH", expected "LOGBRUSH":
> var LBrush : TLogBrush;
> ExtCreatePen( PS_COSMETIC or PS_ALTERNATE,1, LBrush,0,nil );
> In LCLType, TLogbrush is defined as such:
>  PLogBrush = ^TLogBrush;
>  tagLOGBRUSH = record
>    lbStyle: LongWord;
>    lbColor: TColorRef;
>    lbHatch: PtrInt;
>  end;
>  TLogBrush = tagLOGBRUSH;
> In redef.inc, the function header is defined as ExtCreatePen(PenStyle, 
> Width: DWORD; const Brush: TLogBrush; StyleCount: DWORD; Style: 
> Pointer): HPEN; external 'gdi32' name 'ExtCreatePen';
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal

More information about the fpc-pascal mailing list