Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2014-09

Codetools vs compiler

13 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

patspiper

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.

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).

Thanks,
Stephano

Reply by email

FreeMan
to patspiper
patspiper wrote
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).

If you wanna get quick and without problem, my solution is, on http://www.lazarus.freepascal.org/index.php?page=downloads "Windows (32 Bits) Add ons" link has wince binutils and others, just make clean install this files in winxp x32
I made in virtualbox, new xp and install just that link's files and then make crosscompile to wince.
I update my fpc svn before write this message (r28697) I get fatal error while make "OS_TARGET=wince CPU_TARGET=arm" maybe my binutil has a problem. But still work on vbox, 3 hours ago I added some lines to wince project and sent it, its work on wince.

Reply by email

patspiper
to FreeMan
FreeMan wrote 15 lines
On 20-09-2014 13:42, patspiper wrote: > 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). If you wanna get quick and without problem, my solution is, on http://www.lazarus.freepascal.org/index.php?page=downloads "Windows (32 Bits) Add ons" link has wince binutils and others, just make clean install this files in winxp x32 I made in virtualbox, new xp and install just that link's files and then make crosscompile to wince. I update my fpc svn before write this message (r28697) I get fatal error while make "OS_TARGET=wince CPU_TARGET=arm" maybe my binutil has a problem. But still work on vbox, 3 hours ago I added some lines to wince project and sent it, its work on wince.

I build the WinCE cross compiler without any issue. The issue occurs only when compiling a WinCE project with lazarus svn. Do you use lazarus svn or a stable version?

Stephano

Reply by email

FreeMan
to patspiper
patspiper wrote
I build the WinCE cross compiler without any issue. The issue occurs only when compiling a WinCE project with lazarus svn. Do you use lazarus svn or a stable version?

I wrote my system detail in my bugtracker, fpc and lazarus svn (last update)on kubuntu 14.04 x64
What is yours system detail ?

Reply by email

Mattias Gaertner
to patspiper: While trying to fix bug http://bugs.freepascal.org/view.php?id=26651 (for WinCE), the…
Show quoted text 8 lines
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.

Show quoted text 5 lines
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?

Mattias

Reply by email

patspiper
patspiper wrote 41 lines
On 20/09/14 15:44, Mattias Gaertner wrote: > On Sat, 20 Sep 2014 13:42:44 +0300 > patspiper 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?

Stephano

Reply by email

Mattias Gaertner
to patspiper
[...] 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?

No. They are the same.

Mattias

Reply by email

patspiper
to patspiper: I just realised that the identifier is completely not recognised, ie it is not an issue…
patspiper wrote 48 lines
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 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

Reply by email

Mattias Gaertner
to patspiper
Show quoted text 10 lines
[...] 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.

LCL widget set OS.
The LCL setting has nothing to do with the FPC sources.

You must set Target OS to Wince. By default this will select LCL widgetset wince. Not the other way round.

Mattias

Reply by email

patspiper
to Mattias Gaertner
Mattias Gaertner wrote 18 lines
On Sat, 20 Sep 2014 19:14:31 +0300 patspiper wrote: > [...] > 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. LCL widget set OS. The LCL setting has nothing to do with the FPC sources. You must set Target OS to Wince. By default this will select LCL widgetset wince. Not the other way round.

I should have said both target OS and widgetset. They were both explicitly set to WinCE, and the target CPU to arm.

Stephano

Reply by email

Mattias Gaertner
to patspiper
Show quoted text 5 lines
[...] >> 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.

Thanks for the hint.

I added the include path rtl/TargetOS/wininc for Windows targets.

Mattias

Reply by email

patspiper
to Mattias Gaertner
Mattias Gaertner wrote
[...] Thanks for the hint. I added the include path rtl/TargetOS/wininc for Windows targets.

Although find declaration now rightly fails to locate GetProcessAffinityMask for WinCE, I am not sure how adding rtl/TargetOS/wininc without removing rtl/win/wininc did the trick.

On the other hand, compilation of WinCE projects still fails due to that missing function. I have opened a bug report and included a patch for function GetSystemThreadCount that returns the processor count instead.

http://bugs.freepascal.org/view.php?id=26750

Thanks,
Stephano

Reply by email

Mattias Gaertner
to patspiper
Show quoted text 7 lines
On 20/09/14 21:38, Mattias Gaertner wrote: > [...] > Thanks for the hint. I added the include path rtl/TargetOS/wininc for > Windows targets. Although find declaration now rightly fails to locate GetProcessAffinityMask for WinCE,

As the compiler. Good.

I am not sure how adding rtl/TargetOS/wininc without removing rtl/win/wininc did the trick.

It now finds the right redef.inc.

Mattias

Reply by email