[Lazarus] Codetools vs compiler

patspiper patspiper at gmail.com
Sat Sep 20 18:14:31 CEST 2014


On 20/09/14 17:11, patspiper wrote:
> On 20/09/14 16:29, patspiper wrote:
>> On 20/09/14 15:44, Mattias Gaertner wrote:
>>> On Sat, 20 Sep 2014 13:42:44 +0300
>>> patspiper <patspiper at gmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> While trying to fix bug http://bugs.freepascal.org/view.php?id=26651
>>>> (for WinCE), the compiler complained with:
>>>> Identifier not found "GetProcessAffinityMask" (in utf8process.pp).
>>>>
>>>> However, codetools' find declaration locates the function in
>>>> fpc/rtl/win/wininc/redef.inc.
>>> included in fpc 2.6.4 by
>>> rtl/wince/wince/windows.pp
>>>
>>> which looks right to me.
>> Right!
>>>> Where's the catch?
>>>>
>>>> Note: GetProcessAffinityMask is defined as well in
>>>> fpc/rtl/win/wininc/func.inc (inc file is used for Win32/64 but not for
>>>> WinCE).
>>> They differ by the type of hProcess: THandle vs HANDLE. Maybe there is
>>> a difference on WinCE?
>>
>> GetProcessAffinityMask expects a THAndle as 1st parameter. 
>> GetCurrentProcess's result is a HANDLE.
>>
>> For WinCE, using codetools' find declaration:
>> fpc/rtl/win/wininc/redef.inc: THANDLE = HANDLE
>> fpc/rtl/win/wininc/base.inc: HANDLE = System.THandle
>> fpc/rtl/win/sysosh.inc: THandle = DWord
>>
>> So they are essentially the same.
>>
>> Nevetheless, I tried to cast the 1st parameter to a THandle in the 
>> call to GetProcessAffinityMask, but the problem persists.
>>
>> That seems to be a tough nut to crack.
>>
>> Stephano
>
> I just realised that the identifier is completely not recognised, ie 
> it is not an issue of mismatched parameters. I noted as well the use 
> of compiler directives such as {$IF defined(windows)} instead of 
> {$IFDEF WINDOWS} in lazarus/components/lazutils/utf8process.pp. Could 
> this be the cause?

I guess I found the cause. The problem is 2 fold:

1- The function GetProcessAffinityMask is not defined for WinCE, as it 
is not defined in fpc/rtl/wince/wininc/redef.inc (as opposed to 
fpc/rtl/win/wininc/redef.inc which includes GetProcessAffinityMask). 
Hence this function should be eliminated from utf8process.pp for WinCE.

2- Codetools are still pointing to the win version of redef.inc 
eventhough the project's LCLwidgetset is WinCE.

Stephano




More information about the Lazarus mailing list