Recent

Author Topic: Converting From Delphi 7  (Read 2783 times)

hollymcr

  • Newbie
  • Posts: 3
Converting From Delphi 7
« on: August 16, 2021, 11:41:14 am »
Apologies if this is the wrong forum I couldn't see a more specific one.

I have a number of Delhi 7 applications that I would like to port across to Lazarus. Making them cross-platform in the process would be cool - I mostly use Linux these days - but for now getting them to work in 32-Bit Windows would be a good starting point. I have never had much luck using the Delphi Conversion tool.

I think what I'm looking for is some general advice: Is it usually more hassle than it's worth or is it worth the effort?

My apps are generally pretty small in themselves but rely on open source libraries that haven't themselves been maintained for years; if I could succeed it giving those libraries a new lease of life that would be great. (I used Delphi a lot back in the day but these days I'm mostly writing in script languages like Python so I'm a bit rusty when it comes to GUI apps and compilers!)

As a specific example of a library I need to use right now: https://github.com/engycz/propc - unlikely to be of interest to many people but a good example because it's quite small, doesn't have many dependencies, and comes with lots of simple sample applications.

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: Converting From Delphi 7
« Reply #1 on: August 16, 2021, 12:09:04 pm »
A brief look indicates that the dependencies probably include OLE functionality.
OLE is Windows-only, so while it can be converted from Delphi to Lazarus OK, it will not be cross-platform unless you rewrite it from scratch to exclude the dependency on OLE.

hollymcr

  • Newbie
  • Posts: 3
Re: Converting From Delphi 7
« Reply #2 on: August 16, 2021, 01:03:44 pm »
OPC (well OPC-DA for any pedants who also know OPC!) is inherently OLE (OPC stands for OLE for Process Control) so you're right that this would be a bad example for cross-platforming. It's just the most pressing of the libraries I want to convert, as at the moment that's forcing me to write new code in D7 which is just crazy in 2021!

Porting it to Lazarus would mean I can get back into Pascal programming but using FPC, which would be vastly preferable to getting it working in Delphi 10.3 (which I suspect would be at least as difficult anyway).

However any time I try to import a Delphi project into Lazarus using the Delphi Converter tool nothing seems to happen - if I open the .dpk I get a Lazarus package window open but no files in it - quite possibly I'm misunderstanding the steps I am supposed to follow.


paweld

  • Hero Member
  • *****
  • Posts: 1596
Re: Converting From Delphi 7
« Reply #3 on: August 16, 2021, 01:09:34 pm »
Best regards / Pozdrawiam
paweld

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2032
  • Former Delphi 1-7, 10.2 user
Re: Converting From Delphi 7
« Reply #4 on: August 16, 2021, 01:10:15 pm »
I have never had much luck using the Delphi Conversion tool.
I think what I'm looking for is some general advice: Is it usually more hassle than it's worth or is it worth the effort?


I haven't looked at what you want to convert, so I'm really only addressing the conversion from Delphi to Lazarus + Free Pascal.

I did try the Delphi Conversion Tool a while ago and did not get anywhere when converting a handful of Delphi applications to Lazarus + FP. After that, I took the brute force approach.

I started by finding, generally cross-platform, Uses clause equivalents and commenting out anything for which I couldn't find a replacement. I then moved on to trying to compile and commented out any code which caused an error. I quickly ended up with something which would compile but lacked a few Windows-specific features, most of which I could replicate in FreeBSD and Linux except for the Windows taskbar which I ultimately omitted from the non-Windows versions.

hollymcr

  • Newbie
  • Posts: 3
Re: Converting From Delphi 7
« Reply #5 on: August 16, 2021, 01:47:30 pm »
few info about opc for lazarus: https://forum.lazarus.freepascal.org/index.php/topic,9912.0.html

Thanks for that. I had seen it (some time ago); for my use case I need OPC server not client (and not UA) so not directly relevant - but it might have some clues about things I need to look at when porting the server code I have.

(OPC-UA might well be easier but unfortunately it is a very different protocol from OPC-DA and it's only DA that the client I need to talk to supports. But I don't really want to get distracted into the specifics of OPC, really I "just" need to better understand the best approach to taking Delphi code from 10+ years ago and getting it to compile in Lazarus today. By its nature a lot of it will be Windows-specific but that's fine - if I can compile it in FPC I'm still happy as it means I can use Lazarus for other projects.)

 

TinyPortal © 2005-2018