Recent

Author Topic: ExCtrls component: can't compile package  (Read 450 times)

zoltanleo

  • Sr. Member
  • ****
  • Posts: 257
ExCtrls component: can't compile package
« on: July 14, 2020, 01:46:18 am »
Hi guys.

I try to compile package ExCtrls r7540 (win10 x64, fpc trunk, Lazarus trunk). I get error
Code: Pascal  [Select][+][-]
  1. Compile package ExCtrlsPkg 0.0: Exit code 1, Errors: 2, Warnings: 1, Hints: 7
  2. spinex.pp(125,32) Hint: Parameter "Sender" not used
  3. spinex.inc(75,3) Warning: Case statement does not handle all possible cases
  4. spinex.pp(127,27) Hint: Parameter "Sender" not used
  5. spinex.inc(242,17) Error: Can't determine which overloaded function to call
  6. math.pp(2386,10) Hint: Found declaration: SameValue(const Single;const Single):Boolean;
  7. math.pp(2368,10) Hint: Found declaration: SameValue(const Double;const Double):Boolean;
  8. spinex.inc(192,17) Error: Can't determine which overloaded function to call
  9. math.pp(2386,10) Hint: Found declaration: SameValue(const Single;const Single):Boolean;
  10. math.pp(2368,10) Hint: Found declaration: SameValue(const Double;const Double):Boolean;
  11. exeditctrls.pas(318,14) Hint: Local variable "s" of a managed type does not seem to be initialized

Tell me, pls, what's the matter? For win7 x64 the package are compiled without problems...
« Last Edit: July 14, 2020, 01:47:56 am by zoltanleo »
Win10 LTSC x64/Deb 10 amd64:
Lazarus x32/x64 2.1(r.63554); FPC 3.3.1 (r.45871), FireBird 3.0.6

Sorry for my bad English, I'm using translator ;)

Bart

  • Hero Member
  • *****
  • Posts: 3856
    • Bart en Mariska's Webstek
Re: ExCtrls component: can't compile package
« Reply #1 on: July 14, 2020, 10:58:20 am »
Without source is't hard to tell, but IIRC there were problems with SameValue() with Currency.
These should be resolved now in fpc trunk.

Bart

Thaddy

  • Hero Member
  • *****
  • Posts: 10282
Re: ExCtrls component: can't compile package
« Reply #2 on: July 14, 2020, 11:40:46 am »
Yes it is recently fixed., here's a work-around for older versions:
Code: Pascal  [Select][+][-]
  1. {$mode delphi}{$H+}
  2. uses math;
  3. function SameValue(const A, B: Currency; Epsilon: Currency = 0): Boolean;
  4. const  
  5.   SZeroResolution = 1E-4;
  6. begin
  7.   if Epsilon=0 then
  8.     Epsilon:=Max(Min(Abs(A),Abs(B))*SZeroResolution,SZeroResolution);
  9.   if (A>B) then
  10.     Result:=((A-B)<=Epsilon)
  11.   else
  12.     Result:=((B-A)<=Epsilon);
  13. end;
  14. begin
  15. end.
I am more like donkey than shrek

zoltanleo

  • Sr. Member
  • ****
  • Posts: 257
Re: ExCtrls component: can't compile package
« Reply #3 on: July 14, 2020, 03:11:37 pm »
Hi guys. Thank you for answers.
These should be resolved now in fpc trunk.
I use fpc trunk so, but I get a compilation error

Yes it is recently fixed., here's a work-around for older versions
What does the “old version” mean? Recent changes were made to the package in r7485, but I am using r7540.
Win10 LTSC x64/Deb 10 amd64:
Lazarus x32/x64 2.1(r.63554); FPC 3.3.1 (r.45871), FireBird 3.0.6

Sorry for my bad English, I'm using translator ;)

PascalDragon

  • Hero Member
  • *****
  • Posts: 1941
  • Compiler Developer
Re: ExCtrls component: can't compile package
« Reply #4 on: July 14, 2020, 03:18:15 pm »
Hi guys. Thank you for answers.
These should be resolved now in fpc trunk.
I use fpc trunk so, but I get a compilation error

Newer than revision 45707?

Yes it is recently fixed., here's a work-around for older versions
What does the “old version” mean? Recent changes were made to the package in r7485, but I am using r7540.

"Older" as in "FPC 3.2 and older".

zoltanleo

  • Sr. Member
  • ****
  • Posts: 257
Re: ExCtrls component: can't compile package
« Reply #5 on: July 14, 2020, 03:37:38 pm »
Newer than revision 45707?
Yes, sir  ;)
my profile signature: ... Lazarus x32/x64 2.1(r.63554); FPC 3.3.1 (r.45871)...

"Older" as in "FPC 3.2 and older".
Now I understand, thanks for the tips
Win10 LTSC x64/Deb 10 amd64:
Lazarus x32/x64 2.1(r.63554); FPC 3.3.1 (r.45871), FireBird 3.0.6

Sorry for my bad English, I'm using translator ;)

wp

  • Hero Member
  • *****
  • Posts: 7356
Re: ExCtrls component: can't compile package
« Reply #6 on: July 14, 2020, 07:39:09 pm »
IIRC there were problems with SameValue() with Currency. These should be resolved now in fpc trunk.

This code
Code: Pascal  [Select][+][-]
  1. program Project1;
  2.  
  3. uses
  4.   math;
  5.  
  6. var
  7.   c1, c2: Currency;
  8.  
  9. begin
  10.   c1 := 1000;
  11.   c2 := 1001;
  12.   if SameValue(c1, c2) then
  13.     WriteLn('equal')
  14.   else
  15.     WriteLn('different');
  16.  
  17.   ReadLn;
  18. end.
does not compile of 64-bit Windows with Laz trunk/FPC3.2.0, Laz 2.0.10/FPC 3.2, Laz 2.0.8 / FPC 3.0.4 ("Can't determine which overloaded function to call"), but it does with Laz 2.0.10 / FPC trunk. Therefore, you are right: the Currency issue of Samevalue is solved.

However, this is not all. Returning to the original problem of not being unable to compile the ExCtrls package I noticed that it does compile with all of the mentioned versions except for FPC-trunk (64 bit - it does compile with FPC-trunk 32bit). Interestingly the error message the same as before for the others: "Can't determine which overloaded function to call" although the same compiler is able to compile the above test program for SameValue()...

It is my feeling that the issue is related to the use of generics by the TSpinEditExBase control (unit lcl/spinex.pp) which is the ancestor of TCurrSpinEditEx because there were some changes in generics with FPC trunk, and there is some discussion about them.
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

 

TinyPortal © 2005-2018