[fpc-pascal] Typechecking problem porting from D7

Frank de Groot / Rent-a-Geek frank at rentageek.no
Mon Sep 15 22:51:11 CEST 2008

Hi guys - after a decade using Delphi, I finally switched to FPC! I like it 
a lot, so far.
Porting some code, I am stuck with something that looks trivial, however, 
and I hoped someone here can help out?
(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;
  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';

More information about the fpc-pascal mailing list