Recent

Author Topic: Possible issue with Delphi Conversion?  (Read 532 times)

mvandere

  • Newbie
  • Posts: 5
Possible issue with Delphi Conversion?
« on: July 30, 2024, 02:15:54 am »
Just converted my first Delphi program and the change from CloseHandle to FileClose essentially mangled the expected line and the previous one.

Eg

              + 'Note that some older displays must be updated in manual mode.') ;
    CloseHandle(comh);

became
    + 'Note that some older displays must be updated in manFileClose(comh); { *Converted from CloseHandle* }closehandle(comh) ;

This happened in every case. Something to do with the fact that the input file has CR/LF pairs?

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4507
  • I like bugs.
Re: Possible issue with Delphi Conversion?
« Reply #1 on: July 30, 2024, 07:50:31 am »
Please provide a whole unit for testing.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

mvandere

  • Newbie
  • Posts: 5
Re: Possible issue with Delphi Conversion?
« Reply #2 on: July 30, 2024, 08:48:35 am »
OK, so the cause of the error is the
{$I something.inc }
Inherit/include.
The converter makes a few mistakes
1. It ignores the search path in the dproj file and hence doesn't find 'something.inc'
2. It doesn't report this as an error
3. It stuffs up the positioning of the "FileClose(comh); { *Converted from CloseHandle* }" change.

If 'something.inc' is placed in the project folder it does the correct thing.

cdbc

  • Hero Member
  • *****
  • Posts: 1496
    • http://www.cdbc.dk
Re: Possible issue with Delphi Conversion?
« Reply #3 on: July 30, 2024, 09:30:33 am »
Hi
In Project Options -> Paths -> Include files (-Fi): Add your path to "something.inc" or click the elipsis(...) and find it via dialogs...
This way you don't have to place the include file in project directory.
HTH
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4507
  • I like bugs.
Re: Possible issue with Delphi Conversion?
« Reply #4 on: July 31, 2024, 07:16:04 pm »
1. It ignores the search path in the dproj file and hence doesn't find 'something.inc'
2. It doesn't report this as an error
The .dproj files are not supported yet by the converter. It was originally made for the old Delphi 7 type projects where .dproj did not exist.
Yes, they should be supported.
The converter also does not understand dotted unit names used by recent Delphi versions. There are many things that should be improved.
On the other hand recent Delphi and Lazarus and their libraries / components have diverged so much that an automatic conversion may not be realistic. It is still realistic to convert some old Delphi 7 apps fully automatically though.

Quote
3. It stuffs up the positioning of the "FileClose(comh); { *Converted from CloseHandle* }" change.
The converter should handle that better even if the .inc file is not found. Somebody should debug what happens there.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

 

TinyPortal © 2005-2018