A private build of Free Pascal cross-compiler (from i386-win32 to x86_64-win64), version 2.3.1
|Developer(s)||Florian Klämpfl & Volunteers|
|Stable release||2.4.0 / January 1, 2010|
|Written in||Object Pascal and Assembly|
|License||GNU General Public License|
Free Pascal (FPC for short, and formerly known as FPK Pascal) is a free, portable and open source compiler for Pascal and Object Pascal languages. It supports a number of dialects, including the two most popular Borland dialects—Turbo Pascal and Delphi—and some Mac Pascal constructs.
Free Pascal is available on many architectures and operating systems (see Targets), and belongs to the write once, compile anywhere campaign. It has an excellent support for integration of assembly language, and supports multiple architectures and notations in the internal assembler.
Free Pascal adopted the de facto standard dialects of modern Pascal programmers—the Borland dialects. From version 2.0 on, the Delphi 7 compatibility has been continuously implemented or improved.
In fact, the project has a compilation mode concept, and the developers made it clear that they would incorporate working patches for the ANSI/ISO standardized dialects to create a standards-compliant mode.
A small effort has been made to support some of the Apple Pascal syntax, to ease interfacing to Mac OS and Mac OS X. Since the Apple dialect implements some of the Standard Pascal features that Turbo Pascal and Delphi miss, Free Pascal is a bit more ISO-compatible than these.
The 2.2.x series does not significantly change the dialect objectives beyond Delphi 7, instead they aim for a more close compatibility. The project still lacks some Delphi functionality, namely, compiler-supported exporting of classes from shared libraries, which is useful, for example, for Lazarus, which implements packages of components.
In the current development branch, several D2006 specific features have been added, and have some of the starting work for D2009 features (most notably TUnicodeString) done. The development branch also features an Objective Pascal extension for Objective C (Cocoa) interfacing.
Florian Paul Klämpfl, a then-student, started working on his own compiler. The compiler was written in the Turbo Pascal dialect from the start, and produced 32-bit code for the go32v1 extender, which was used and developed by the DJGPP project at that time.
The initial 32-bit compiler was published on the Internet, and the first contributors joined the project.
The DOS version also improved gradually, and migrated to the go32v2 extender. This culminated in the 0.99.5 release, which was much more widely used than previous versions, and was the last release aiming only for Turbo Pascal compliance—later releases would add a Delphi compatibility mode. This release was also ported to systems using a 680x0.
With the 0.99.8 release, the Win32 target was added, and a start was made with incorporating some Delphi features. Stabilizing for a 1.0 release began, and this milestone was reached in July 2000. The 1.0.x series was widely used, both as an enterprise and educational tool. For the 1.0.x releases, the port to 68k CPU was redone, and the compiler produces stable code for a number of 68k Unix, and AmigaOS.
During the stabilization of what would become 1.0.x, and specially when porting to the Motorola 68k systems, it was clear that the design of the code generator was far too limited in many ways. The principal problems were that adding processors basically meant rewriting the code generator, and that the register allocation was based on the principle of always keeping three free registers between building blocks, which was inflexible and hard to maintain.
For these reasons, the 1.1.x branched from the 1.0.x main branch in December 1999. At first, changes were mostly clean-ups 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 and Fall, 2004, respectively. The AMD64 port followed in early 2004, which made the compiler available for a 64-bit platform.
Version 1.9.4 was special because it was the first version with Mac OS X support.
During 2006, some of the major reworks planned for 2.2, such as the rewrite of the unit system, had not started yet, and it was decided to start stabilizing the already implemented features.
Some of the motivations for this roadmap change were the needs of the Lazarus project, particularly the internal linker, support for Win64, Windows CE, and Mac OS X on x86, and related features like DWARF. After a short series of betas (2.1.2 and 2.1.4), the version 2.2.0 was released in September 2007, followed by the version 2.2.2 in August 2008, and then version 2.2.4 in March 2009.
The 2.2.x series vastly improve the ActiveX/COM, interface, and OLE support, though bugs are still being found. The delegation to interface using the
implements keyword is partially implemented but not complete.
Aside from the language support, the library support for ActiveX was also improved.
Another major highlight was the internal linker for Win32, Win64, and Windows CE, which strongly improves linking time and memory use, and makes the compile-link-run cycle in Lazarus much more bearable. The efficiency for smart-linking, or dead code elimination, has also been improved.
Minor new features are improved DWARF (2/3) debug format support, and optimizations like tail recursion, omission of unneeded stack frames and register-based CSE optimization. A first implementation of generics support is also available, but only for exploration purposes.
It is currently unsure if the improved in-binary resource support in 2.3.x will be merged to 2.2.4.
Free Pascal's availability depends on the major version.
In addition to most targets supported by 2.2, this version supports: