Link to home
Start Free TrialLog in
Avatar of EXF_Pilatus
EXF_Pilatus

asked on

Compile Delphi-written program with FPC

When compiling a Delphi written program with FPC, some incompatibilities occur. The question is how to deal with these incompatibilities. Delphi has a large amount of pre-installed units to be used, as does FPC. For example: the unit 'Math' is used by both compilers but there are many other units that are not compatible.

I have two questions concerning the units depicted below:
1. Is there a way to make Delphi units compatible with FPC?
2. If not, are there any equivalent units that do the same and can be used in FPC?

The following units in my Delphi program are not compatible with FPC:
- Comobj,
-  Windows,
-  ShellAPI,
-  ActiveX,
-  Forms,
-  FileCtrl
Avatar of Geert G
Geert G
Flag of Belgium image

this may sound stupid, but what is fpc ?
ASKER CERTIFIED SOLUTION
Avatar of Cedric_D
Cedric_D

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of EXF_Pilatus
EXF_Pilatus

ASKER

Thanks for your reply,

To Geert: FPC is Free Pascal Compiler

To Cedric:
- Comobj,
-  Windows,
-  ShellAPI,
-  ActiveX,
-  Forms,
-  FileCtrl
It appears indeed that these units are platform specific: they are accepted when used in Delphi on a windows platform and they are not accepted when used with FPC on our Linux cluster computer.  

Does anyone know if there are units for FPC that do exactly the same as the units, depicted above, used in Delphi?
Have you seen the Lazarus Project ?

http://wiki.lazarus.freepascal.org

Are you trying to port a Delphi Windows application to Linux ?
I can't help there yet, just installed Ubuntu this weekend and
now looking to install a Delphi version, so i'm new too on this path.
No, we are trying to port a Delphi console application to run it in Linux. Any experience in that?
it won't work.
I had that experience ...

What does the console do ?

Maybe you can delete the units mentioned ...

A console application using Forms ?
I looked into converting some of our projects from Delphi 6 to FPC, Dev-Pascal, and Lazarus.  If you have forms and visual components, give up all hope. I even tried to convert just a DLL even that was wracked with hundreds and hundreds of syntax errors. It was big complex DLL, but just a DLL nonetheless. No forms or visual components at all. I gave up.

In my opinion, you need to start from scratch in developing in these other pascals. It's less work than "converting."
Thanks for your comments.

I tried to delete some of the units and at a first glance, it appeared that the following units are not needed by the program I use:
-  Comobj,
-  Windows,
-  ShellAPI,
-  ActiveX,
-  Forms,
So quite alot! Should have known this before posting this question. Nonetheless, FileCtrl is needed:
-  FileCtrl
Does there exist any replacement in FPC (or Lazarus) for this unit?

I'm probably looking at the tip of the iceberg concerning all the (syntax)errors FPC will give me but it is to much work though to rewrite my 200 page program...
There is just maybe the chance you are using the function SelectDirectory ???

Look at the help function for SelectDirectory
there are 2 possibilities ...
don't use it or add QDialogs
In the project options check the Warnings and Hints
and specifically look at the Warnings for platform specific

if you resolve all these platform specific (windows) issues, it should work
Thanks for your answers. I managed to compile the program in FPC, not using any of the previous mentioned units. I had to add some other units though:
- Classes
and
- Process

It works now!
please clarify why you gave a C ?
i would be happy to accept a reason why a C grade was given
and have the opportunity to act on that reason
I don't use this site to waste time discussing the marks for answers. To keep it short: I gave a C because none of the above comments, neither yours, gave a satisfying answer to my question. Cedric D helped me the most.

I appreciate it that you're trying to help me though.