Solved

Compile Delphi-written program with FPC

Posted on 2008-10-20
17
1,582 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 36

Expert Comment

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

Accepted Solution

by:
Cedric_D earned 500 total points
Comment Utility
- 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
Comment Utility
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
 
LVL 36

Expert Comment

by:Geert Gruwez
Comment Utility
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
Comment Utility
No, we are trying to port a Delphi console application to run it in Linux. Any experience in that?
0
 
LVL 36

Expert Comment

by:Geert Gruwez
Comment Utility
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
Comment Utility
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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

Author Comment

by:EXF_Pilatus
Comment Utility
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 36

Expert Comment

by:Geert Gruwez
Comment Utility
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 36

Expert Comment

by:Geert Gruwez
Comment Utility
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
Comment Utility
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 36

Expert Comment

by:Geert Gruwez
Comment Utility
please clarify why you gave a C ?
0
 
LVL 36

Expert Comment

by:Geert Gruwez
Comment Utility
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
Comment Utility
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
In our personal lives, we have well-designed consumer apps to delight us and make even the most complex transactions simple. Many enterprise applications, however, are a bit behind the times. For an enterprise app to be successful in today's tech wo…
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

744 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now