Recent

Author Topic: compile error with dcpcrypt  (Read 1217 times)

senglit

  • Full Member
  • ***
  • Posts: 141
compile error with dcpcrypt
« on: October 19, 2022, 04:25:10 am »
hi,

I have a project developed on window10 lazarus 2.2.0 which works fine. When I copy the source code and compile it on my target os armv7l-linux4.4.83-ubuntu18 with FPC 3.3.2 everything is ok, it works as expected.

Then I import a required package "dcpcrypt", of which function TDCP_rc4.DecryptString is used. It also works well on win10. Then I copy it to my target os with related files dcpbase64.pas, dcpconst.pas, dcpcrypt2.pas, dcprc4.pas and dcpsha1.pas.

when I comple the project, I get this:
Code: Text  [Select][+][-]
  1. root@sunny:/home/senglit# fpc mytarget.pp
  2. Compiling mytarget.pp
  3. Compiling module1.pas
  4. ...
  5. ......
  6. Compiling dcprc4.pas
  7. Compiling dcpcrypt2.pas
  8. Compiling dcpbase64.pas
  9. dcpbase64.pas(81,3) Error: Identifier not found "Result"
  10. dcpbase64.pas(86,13) Error: Identifier not found "Result"
  11. dcpbase64.pas(87,27) Error: Identifier not found "Result"
  12. dcpbase64.pas(98,3) Error: Identifier not found "Result"
  13. dcpbase64.pas(114,5) Error: Identifier not found "Result"
  14. dcpbase64.pas(118,7) Error: Identifier not found "Result"
  15. dcpbase64.pas(125,7) Error: Identifier not found "Result"
  16. dcpbase64.pas(134,13) Error: Identifier not found "Result"
  17. dcpbase64.pas(135,13) Error: Identifier not found "Result"
  18. dcpbase64.pas(135,44) Error: Identifier not found "Result"
  19. dcpbase64.pas(140) Fatal: There were 10 errors compiling module, stopping
  20. Fatal: Compilation aborted
  21. Error: /usr/bin/ppcarm returned an error exitcode
  22.  

What's wrong? the "Result" is the return value of a function, how can it be wrong?
I use Win11 + Lazarus3.6 + FPC Trunk. fpcupdeluxe

senglit

  • Full Member
  • ***
  • Posts: 141
Re: compile error with dcpcrypt
« Reply #1 on: October 19, 2022, 05:21:45 am »
I manully changed the Identifier "Result" in dcpbase64.pas to it's function name. Now it works on my target os armv7l-linux4.4.83-ubuntu18. But I got compile error on my develop evironment win10+lazarus2.2.0 O:-)

I guess somewhere there is a switch to define how to return the result of function (by function name or "Result"). The dcpbase64.pas file must defined to defaultly use function name under FPC3.3.2 but "Result" under lazarus.

It's a little bit annoying, for I would probably forget this fact long time later and get problem in maintainance. But I just don't know how to make it same on these two platform.
I use Win11 + Lazarus3.6 + FPC Trunk. fpcupdeluxe

PascalDragon

  • Hero Member
  • *****
  • Posts: 6359
  • Compiler Developer
Re: compile error with dcpcrypt
« Reply #2 on: October 19, 2022, 07:30:22 am »
DCPCrypt is originally a Delphi unit, so you need to add {$mode delphi} at the top of these units. This is probably set this way in the corresponding Lazarus package thus why it works there. Or if you did not use the package, but compiled directly then the mode of your project will be used (which is usually {$mode objfpc} which depending upon the code might work as well). The default of the compiler binary itself however is {$mode fpc} which is more Turbo Pascal compatible.

senglit

  • Full Member
  • ***
  • Posts: 141
Re: compile error with dcpcrypt
« Reply #3 on: October 21, 2022, 04:41:14 pm »
I added {$mode objfpc} into dcpbase64.pas then it's ok with return by "Result" on armv7l-linux4.4.83-ubuntu18.
Thanks for your reply.

DCPCrypt is originally a Delphi unit, so you need to add {$mode delphi} at the top of these units. This is probably set this way in the corresponding Lazarus package thus why it works there. Or if you did not use the package, but compiled directly then the mode of your project will be used (which is usually {$mode objfpc} which depending upon the code might work as well). The default of the compiler binary itself however is {$mode fpc} which is more Turbo Pascal compatible.
I use Win11 + Lazarus3.6 + FPC Trunk. fpcupdeluxe

 

TinyPortal © 2005-2018