< Back to index

Free Pascal (or FPK Pascal or even FPC Pascal) is a portable, open source Pascal compiler.

Introduction


Free Pascal is a 32/64-bits multi-CPU architecture and multi-Operating System compiler. The compiler implements the Borland Pascal dialects (Turbo Pascal and Delphi) as well as some MacPascal constructs and is available for
most common operating systems.

Free Pascal used to be known as FPK Pascal, since FPK are the initials of the author, Florian Paul Klämpfl. FPK Pascal never meant "Free Pascal Kompiler" though a lot of people thought so. Writing "Compiler" with K is uncommon in German anyway. At the end of 1997, the name of the project was changed into Free Pascal Compiler (FPC) to avoid this confusion and because more and more people did contribute.

FPC is a reasonably well documented project, with manuals having 1800 pages in total.

The visual parts of the Delphi libraries (the VCL) and the creation of a visual IDE and RAD are part of a separate project, Lazarus.

Free Pascal comes with a text mode IDE resembling Turbo Pascal's IDE. This IDE deteriorated for some time because of a missing maintainer, but in a common effort in the second half of 2005 and the first months of 2006, most major bugs were fixed and the IDE became release-worthy again.

Like Turbo Pascal and Delphi, Free Pascal has excellent support for integration of assembly language in the Pascal code. FPC even supports multiple architectures and notations in the internal assembler.

Language dialect


FPC adopted the de facto standard dialects of Pascal programmers: the Borland dialects. (Specifically: Borland Pascal 7 and Delphi 2 for version 1.0.x, and for version 2.0.x the target versions for the Delphi compatibility changed to 6/7).

However the project has a compilation mode concept, and the team made clear that it would incorporate working patches for the ANSI/ISO standardised dialects to create a standards compliant mode.

Also, a small effort has been made to support some of the Apple Pascal syntax, to ease interfacing to Mac OS (X).

Missing Delphi functionality

* Delegation using the "implements" keyword
* Automatic COM IDispatch dual interfaces (dispinterfaces)
* dispid in normal interfaces
* packages: compiler supported import/export of classes from/to shared libraries (useful for e.g. Lazarus, which implements packages of components)
* set types can have different size.

History


The early years


Free Pascal emerged when Borland made clear there would be no Borland Pascal 8, and the next version
would be a Windows-only product (which turned out to become Delphi later on), and a student (Florian Paul Klämpfl) started working on his own compiler. The compiler was written in the (Borland) Turbo Pascal dialect from the start and produced 32-Bit code for the go32v1 DOS extender used and developed by the DJGPP project at this time. Originally the compiler itself was a 16-bit Dos executable compiled by Turbo Pascal. After two years, the compiler was able to compile itself so it became 32-bit too.

Expansion


The initial 32-bit compiler was published on the net, and the first contributors joined the project. In the years after publishing on the Internet, a Linux port was made by Michael van Canneyt (a full 5 years before Kylix), the DOS port was adapted for use in OS/2 through the EMX extender. The DOS version also improved gradually, and migrated to the go32v2 extender. This culminated in the 0.99.5 release that was much more widely used than the versions before, and the last release aiming only for Turbo Pascal compliance: later releases would add a Delphi compatibility mode. 0.99.5 was also ported to systems using a 680x0 CPU.

With 0.99.8, the Win32 target was added, and a start was made with incorporating some Delphi features. Stabilising for a 1.0 release started, and this milestone was reached in July 2000. The 1.0.x series (and the bug-fix/stabilisation releases that followed, last, 1.0.10 in July 2003) was widely used, both as an enterprise and educational tool. For the 1.0.x releases, the port to 680x0 CPUs was redone, and the compiler produces stable code for a number of 68k Unixes and AmigaOS.

The Next Generation


During the stabilisation of what would become 1.0.x, and specially when porting to the m68k systems, it was clear the design of the code generator was far too limited in many ways. The two most
principal problems were that adding processors basically meant rewriting the code generator, and that
the register allocation was based on a principle (always keep 3 free registers between building blocks) that was hard to maintain and inflexible.

For these reasons, FPC 1.1.x branched from the 1.0.x main branch in December 1999. At first, changes were mostly cleanups and rewrite/design to all parts of the compiler, and then the code generator and register allocator were rewritten. As a bonus, remaining missing Delphi compatibility was added.

The work on 1.1.x continued slowly but steadily, and in late 2003 the PowerPC port started working, followed by ARM and Sparc ports in summer/fall 2004. The AMD64 port followed in early 2004. The AMD64 port effectively made the compiler 32/64-bit.

In November 2003, a first beta release of the 1.1.x branch was packaged, and for the occasion, the version number was upped to 1.9.0. These were followed quickly by 1.9.2 and 1.9.4. 1.9.4 was special because it was the first version with Mac OS X support.

The work continued with 1.9.6 (Jan. 2005), 1.9.8 (late Feb. 2005), 2.0.0 (May 2005), [http://www.freepascal.org 2.0.2 (Dec. 2005).], and 2.0.4 (Aug. 2006).

The future


Currently, the following features are missed most dearly. The features with (*) are currently actively being worked on in the 2.1.x branch.

* Create/improve the COM/OLE support. This has multiple facets:
* *COM compatible interfaces/vmt
* *(OLE)Variants (needed for OLE)
* *implements style delegation (*)
* Linking/debug/file formats related:
* *Improve smart linking (get rid of .a files, less memory use) (*) - wince/32/64 only.
* *Improved "packages" and dynamic libraries (PIC!) support in general.
* *Improve cross linking. (*)
* *stabs->dwarf crossover. (*) - 64-bit platforms first.
* *Some form of Kylix compatible resources. (Still under discussion)
* Apple Pascal related
* *Being able to pass a subprocedure to a different procedure as a procvar.

Some of these target functionality (specially in the linking section) might require restructures related to:

* Introduction of an internal linker for some core platforms. (Removing the external linker, LD) (*) - wince/32/64 only.
* Rewrite of module (unit) handling, postponed to post 2.2

Targets


The FPC compiler's availability depends on the major version.

Version 2.1.x (development version)


* Win64
* Mac OS X (on Intel)
* PowerPC 64-bit
* WinCE
* Game Boy Advance (standard ARM only)

Version 2.0.x


The current stable version 2.0.4 supports the following

Processors:
* iA-32: Intel 80386 and compatibles
* *AMD64: x86_64
* PowerPC
* ARM
* Sparc v8 and v9

Operating systems:
* Linux: all CPUs
* BSD and family
* *FreeBSD
* *Mac OS X and Darwin (PowerPC)
* Mac OS
* DOS; Go32V2 extender. PMode extender sometimes used for embedded systems
* Win32
* OS/2: EMX and native
* Novell NetWare

Version 1.0.x


The previous stable release 1.0.x was available for processors
* Intel 80386 and compatibles
* Motorola 680x0

and supported the following operating systems
* Linux: x86/m68k
* BSDs
* *FreeBSD
* *NetBSD: x86/m68k
* DOS: Go32V2 extender. PMode extender sometimes used for embedded projects
* Win32
* OS/2: EMX
* Amiga Classic, m68k

and the beta platforms:
* BeOS, beta
* A beta for OpenBSD/x86 existed at some point.
* SunOS, Solaris
* QNX
* Windows CE
This entry uses material from from Wikipedia, the leading user-contributed encyclopedia. It is licensed under the GNU Free Documentation License. Disclaimer.