Recent

Author Topic: How to convert a Delphi package to FPC?  (Read 1029 times)

jonnybravo

  • New Member
  • *
  • Posts: 13
How to convert a Delphi package to FPC?
« on: April 02, 2022, 04:49:57 pm »
How to convert a Delphi package to FPC? :)

Thaddy

  • Hero Member
  • *****
  • Posts: 12174
Re: How to convert a Delphi package to FPC?
« Reply #1 on: April 02, 2022, 05:49:19 pm »
RTFM?
Manuals, manuals, manuals first.
You have incompetence and sheer incompetence.

Handoko

  • Hero Member
  • *****
  • Posts: 4717
  • My goal: build my own game engine using Lazarus
« Last Edit: April 02, 2022, 05:54:04 pm by Handoko »

440bx

  • Hero Member
  • *****
  • Posts: 3136
Re: How to convert a Delphi package to FPC?
« Reply #3 on: April 02, 2022, 07:00:43 pm »
This thread very succinctly showcases the difference between someone who is _not_ helpful and someone who is.  :D
FPC v3.0.4 and Lazarus 1.8.2 on Windows 7 SP1 64bit.

af0815

  • Hero Member
  • *****
  • Posts: 1035
Re: How to convert a Delphi package to FPC?
« Reply #4 on: April 02, 2022, 07:15:43 pm »
This thread very succinctly showcases the difference between someone who is _not_ helpful and someone who is.  :D
And shows, that some OP never try to search in the internet/wiki. Sorry but RTFM is helpful. This implies to make a research first and after the research make a question. This is the difference.

"How to convert a Delphi package to FPC?" is the same question like "who can write my homework".

The only answer is RTFM with the starting point https://wiki.freepascal.org/Delphi_Converter_in_Lazarus and this is only combining Thaddys and Handokos answeres. And this are the expected basics for a question from the OP.

@jonnybravo:
After the RTFM, try to identify the external components you are using, you must find out if the used components are available in Lazarus or not. If not you can search for compatible componnets or to avoid such components. Eg. if you are using connections to da database, one of good tires is, first switch to zeos on Delphi, because zeos can work with delphi and fpc/lazarus. 

There are a lot of showstopers for a convert. A lot of popular (sometime paid)  components of delphi have no direct components in fpc/lazarus. So you have to test a avoiding or changing to similar componnets in fpc/lazarus. But this can be hard or a no go.
regards
Andreas

Handoko

  • Hero Member
  • *****
  • Posts: 4717
  • My goal: build my own game engine using Lazarus
Re: How to convert a Delphi package to FPC?
« Reply #5 on: April 02, 2022, 07:29:01 pm »
There are many different ways to help. Some need to be scold, some need to be motivated, some need short info and the others may need detailed explanation. Different methods work for different people.

We all are here to help.

wp

  • Hero Member
  • *****
  • Posts: 10268
Re: How to convert a Delphi package to FPC?
« Reply #6 on: April 02, 2022, 07:41:27 pm »
Sorry but RTFM is helpful. This implies to make a research first and after the research make a question. This is the difference.
Normally I would agree with this statement. But you really don't know how much amount of work the OP did put into studying this topic. His question may just be borne out of frustration because he did not find anything useful. And i must say from my experience that using the automatic converter can be frustrating if you don't know what your are doing. Therefore, in agreement with 440bx's comment, I consider "RTFM" to be a very impolite and useless answer.

Rather than working with the automatic converter, I prefer to convert units manually because I know what is changed and for what reason. See https://forum.lazarus.freepascal.org/index.php/topic,48137.msg346285.html#msg346285 for a description of the steps to convert a project (probably there are also other similar descriptions). In case of a package, I'd first create a new package ("Package" > "New package") and add all the units of the Delphi package to it. Next I'd try to compile the package, and the compiler will tell you what's missing. Very probably you will see the "unit not found" error. Find out in which package this unit exists and add the package to the "required packages" list of your package ("Add" > "New Requirement"). The next error probably is in one of the units - adapt it to Lazarus as described in the linked post.

After having converted quite a lot of Delphi packages, I agree with af0815: this task ranges between trivial to impossible...

jonnybravo

  • New Member
  • *
  • Posts: 13
Re: How to convert a Delphi package to FPC?
« Reply #7 on: April 02, 2022, 10:40:25 pm »
Thank you all who responded. I will RTFM and all your comments  ;D
The package I wish to convert is not available in FPC.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 10392
  • FPC developer.
Re: How to convert a Delphi package to FPC?
« Reply #8 on: April 02, 2022, 11:13:38 pm »
Quite often the first step is actually what the package uses, and what you exactly want to use it for.

It is hard to port a very Windows only package that does winapi calls anywhere to Lazarus for its Linux support etc.

Firemonkey usage, Delphi version (heavy utf-16 string usage), some very new (Delphi 10.x and +) features are all barriers to entry. Delphi 7 level support is often more complete

 

TinyPortal © 2005-2018