[Lazarus] How do I fix win32object.inc errors compiling Win64 Lazarus trunk+FPC trunk?

Vincent Snijders vincent.snijders at gmail.com
Thu Oct 11 09:58:10 CEST 2012


2012/10/11 Reinier Olislagers <reinierolislagers at gmail.com>:
> Building Laz trunk+FPC trunk on Windows I get
>
> win32object.inc(565,78) Error: Incompatible type for arg no. 4: Got
> "<address of procedure(QWord;LongWord;LongWord;LongWord);StdCall>",
> expected "<procedure variable type of
> procedure(QWord;LongWord;QWord;LongWord);StdCall>"
> win32int.pp(328) Fatal: There were 1 errors compiling module, stopping
>
> Probably due to FPC trunk FPC r22526
> Eg changes like
> -function SetTimer(hWnd:HWND; nIDEvent:UINT; uElapse:UINT;
> lpTimerFunc:TIMERPROC):UINT; external 'user32' name 'SetTimer';
> +function SetTimer(hWnd:HWND; nIDEvent:UINT_PTR; uElapse:UINT;
> lpTimerFunc:TIMERPROC):UINT_PTR; external 'user32' name 'SetTimer';
>
> My pointer magic is still weak - what do I need to modify here:
> I obviously need to go from the pointer to the UINT to the UINT itself,
> but my messing with @ didn't work...
>
> function TWin32WidgetSet.CreateTimer(Interval: integer; TimerFunc:
> TWSTimerProc) : THandle;
> ...
>     {$IF FPC_FULLVERSION>=20701}
>     // Windows function fixes in FPC r22526
>     TimerInfo^.TimerID := Windows.SetTimer(0, 0, Interval,
> @TimerCallBackProc);
>     {$ELSE}
>     TimerInfo^.TimerID := Windows.SetTimer(0, 0, Interval,
> @TimerCallBackProc);
>     {$ENDIF}

Did you look at the patch supplied with the bug report I gave you?

IMHO, that patch is correct, except:
* use UINTPTR instead of THandle as record field.
* make sure it still compiles/runs with fpc 2.6.0, at least as good as
the current version.

Vincent




More information about the Lazarus mailing list