Solved

Compile Delphi-written program with FPC

Posted on 2008-10-20
17
1,588 Views
Last Modified: 2013-12-13
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
0
Comment
Question by:EXF_Pilatus
17 Comments
 
LVL 37

Expert Comment

by:Geert Gruwez
ID: 22765102
this may sound stupid, but what is fpc ?
0
 
LVL 7

Accepted Solution

by:
Cedric_D earned 500 total points
ID: 22765790
- Comobj,
-  Windows,
-  ShellAPI,
-  ActiveX,
-  Forms,
-  FileCtrl

all these has one in common - they are platform-specific.
However, did you try compile of command-line application with FPC, using these units?
0
 

Author Comment

by:EXF_Pilatus
ID: 22766667
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?
0
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 37

Expert Comment

by:Geert Gruwez
ID: 22767271
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.
0
 

Author Comment

by:EXF_Pilatus
ID: 22767872
No, we are trying to port a Delphi console application to run it in Linux. Any experience in that?
0
 
LVL 37

Expert Comment

by:Geert Gruwez
ID: 22767889
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 ?
0
 
LVL 6

Expert Comment

by:JosephGlosz
ID: 22770733
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."
0
 

Author Comment

by:EXF_Pilatus
ID: 22773918
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...
0
 
LVL 37

Expert Comment

by:Geert Gruwez
ID: 22773932
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
0
 
LVL 37

Expert Comment

by:Geert Gruwez
ID: 22773940
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
0
 

Author Comment

by:EXF_Pilatus
ID: 22794165
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!
0
 
LVL 37

Expert Comment

by:Geert Gruwez
ID: 22819804
please clarify why you gave a C ?
0
 
LVL 37

Expert Comment

by:Geert Gruwez
ID: 22820862
i would be happy to accept a reason why a C grade was given
and have the opportunity to act on that reason
0
 

Author Comment

by:EXF_Pilatus
ID: 22821576
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.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
I use more than 1 computer in my office for various reasons. Multiple keyboards and mice take up more than just extra space, they make working a little more complicated. Using one mouse and keyboard for all of my computers makes life easier. This co…
This video shows how use content aware, what it’s used for, and when to use it over other tools.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question