Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2008-02

Re: Interfacing with the free pascal compiler ?

7 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Skybuck Flying

Hello,

Is there a special way to interface with the free pascal compiler, for example via a DLL/API ?

Or is an IDE supposed to interface via the FPC executable, command line parameters, and input files and console output with possibly output re-direction to files or so ?

For example, I build a small IDE and now I would like to do something for example:

1. Get a list of files tried by the compiler so I don't have to compile those again.

2. Get a list of error messages, possibly per tried file, or simply one big file for chronological programming mistakes.

Bye,
Skybuck.

Daniël Mantione
to Skybuck Flying

Op Mon, 11 Feb 2008, schreef Skybuck Flying:

Show quoted text 10 lines
>> Hello, >> >> Is there a special way to interface with the free pascal compiler, for >> example via a DLL/API ? > > Just use the compiler unit in your project. I want to develop the IDE in Delphi 2007. Is it still possible to interface via the compiler unit ???

No, because Delphi cannot compile the compiler. You can work around this, build a DLL which exposes the compiler unit, then use that DLL from Delphi.

Daniël

Skybuck Flying
to Daniël Mantione

Ok,

I will open source my little IDE so other people can help with it. Or use it in their own IDE.

For now I am looking for:

1. A replacement for RichEdit which has syntax highlighting for pascal/delphi. Line numbers are a big plus.

2. Some help with a DLL/API interface/specification.

For example would it be possible to pass Delphi classess to Free pascal libraries and vice versa ?

(My bet is: probably not :))

So then some other way has to be found to do what I want... I/We will have to give it some thought.

For now I put it on my webdrive but I have little space... so later I will switch to source forge for more space.

Take a look:

http://members.home.nl/hbthouppermans/SkybuckIDE/version%200.02/

For those not on Windows I shall include screenshot as well:

http://members.home.nl/hbthouppermans/SkybuckIDE/version%200.02/SkybuckIDEVersion002Screenshot.JPG

Bye,
Skybuck :)

Guillermo Martínez Jiménez

Esteemed Skybuck,

I've read your messages and I think you didn't understood what Free Pascal is (or may be I didn't understood your questions).

Free Pascal is an Object Pascal compiler, like Delphi, so it's mostly compatible with it but they're quite different since FP doesn't include a RAD IDE nor a component library. They have also some internal differences as compilers; i.e. Delphi creates GUI applications by default while FPC creates console applications by default, also FPC doesn't support the <USES unitname AT "path/unitname.pas"> construction, Delphi can't manage exported variables from dynamic linking modules (DLL, so, dylib...) but FPC does it, etc.

If you're looking for a cross-platform RAD IDE with a component library to use with it you should try Lazarus
(http://www.lazarus.freepascal.org/), which is a RAD IDE that uses Free Pascal and includes a library which is similar than the VCL. But remember that Lazarus isn't Delphi. There are libraries you can use with Delphi that are compatible with FPC/Lazarus (such as Indy, JEDI/SDL or Allegro.pas) but there are a lot of them that aren't.

There's also a copyright problem. Most of the Delphi Library is open sourced, but the license forces to use that sources only with Borland/Code Gear's compilers. So it isn't "possible to pass Delphi classes to Free pascal libraries" (well, it is possible but you mustn't). The other way (use FPC/Lazarus libraries and classes in Delphi) YES IT IS possible.

I hope that helps in your quest.

Guillermo "Ñuño" Martínez

Show quoted text 20 lines
Hello, Is there a special way to interface with the free pascal compiler, for example via a DLL/API ? Or is an IDE supposed to interface via the FPC executable, command line parameters, and input files and console output with possibly output re-direction to files or so ? For example, I build a small IDE and now I would like to do something for example: 1. Get a list of files tried by the compiler so I don't have to compile those again. 2. Get a list of error messages, possibly per tried file, or simply one big file for chronological programming mistakes. Bye, Skybuck.
L
also FPC doesn't support the <USES unitname AT "path/unitname.pas"> construction, Delphi can't manage exported variables from dynamic linking modules (DLL, so, dylib...) but FPC does it, etc.

FPC supports:

uses
   unit1 in "../foo/bar/somefile.pas";

I am using this so I don't have to ship FPC config files in examples and demos for Powtils 1.7.X. (no -Fu search path needed for relative directories when using this trick).

You can even go:

uses
   newname in "someunit.pas";
begin
   newname.callfunction();
end.

You are right though that there are still differencecs between FPC such as not being able to export overloaded functions and minor things that are still feature tweaks.

library example;
exports
   overloaded(param)
   overloaded(different params);
   overloaded(other different params);
end.

Regards,
L505