Free Pascal Compiler Review

By Prokushev

Introduction
The Free Pascal Compiler (FPC or, older name, FPK) is one of the most advanced Pascal compilers for OS/2. Other good Pascal compilers exist but all of them have some disadvantages. One of most known compilers is Virtual Pascal Compiler - a very good compiler with an IDE and good Borland/Turbo Pascal compatibility with support of some Delphi-language extensions. But it's not so dynamically extended and improved nowadays. The Sibyl compiler is another example. Good Visual Development environment (Delphi-like RAD), but too outdated and not developed any more. On another side we have good open source, constantly improved Pascal compiler with excellent support of Turbo Pascal & Borland Delphi dialects. Also other dialects supported like GNU Pascal and MAC Pascal. FPC can be executed on wide range of processors and platforms, including OS/2. At the present time OS/2 version exist in two flavours: EMX and OS/2. EMX is first OS/2 version of FPC. Nowadays EMX not so good supported as the native OS/2 version. The native OS/2 version of FPC still uses EMX libraries to have access to 16-bit functions of OS/2 and EMX tools are still used for compilation. At the present time Watcom tools support is in work. Latest alpha/beta versions of FPC also contain Turbo Vision support (name of Turbo Vision clone is Free Vision) and Turbo Pascal-like IDE. FPC comes with lot of packages (aka libraries) with support some OS/2 specific APIs and lot of cross-platform packages. FPC is an open-source project so everybody of us can improve and extend it (of course, core team can reject your patches if they are out of the general strategy of development).

OS/2 part of FPC team have lot of plans on improvements and extensions for OS/2 version of FPC. Primary goal is native OS/2 target (no EMX tools and libs). For now with help of Watcom tools. Later - via an internal assembler/linker.

FPC/2 at the present
OS/2 version of the compiler is mainly maintained by Tomas Hajny. Other developers (including myself) work on FPC/2 from the time to time. Current FPC/2 supports most of things which are supported for other platforms. The main disadvantage of FPC/2 is that OS/2 target still uses EMX tools and EMXWRAP.DLL. Work to throw away EMX completely (I mean to have two versions of compiler - one with EMX, another without) in progress. Tomas and me removed most of EMX-specific code from OS/2 runtime and replaced them by native OS/2 implementation. One of significant improvement by this work is totally rewritten OS/2 heap manager with high memory support.

Slowly FPC/2 moves to native OS/2 compiler/target support. But some features still not supported. FPC/2 still doesn't support DLL creation. So you can't create REXX library with it. FPC/2 does not support 16-bit calling conversion (thunking). Smart-linking (no unused code in executables) doesn't work very well. Recently Free Vision (Turbo Vision reimplementation) was included in the main distribution, so next version can include text-mode IDE (like in Borland Pascal and Virtual Pascal) and Free Vision itself. Another issue is missing integrated debugger in the OS/2 build of FPC IDE - PMGDB serves as debugger until we have better solution (not that PMGDB would be that bad - it just doesn't support Pascal syntax, so one has to remember to type identifiers in uppercase, use "*POINTER" instead of "Pointer^" and "(NEWTYPE) VARIABLE" instead of "NewType (Variable)". Recently generation of daily OS/2 binary snapshots was restored so you can get the latest development version any time.

FPC/2 in the future
We have a lot of plans for FPC/2 in the future. Because no other active Pascal compilers for OS/2 FPC/2 is only one possible solution. We can and we must improve it. General direction of FPC/2 is, as mentioned above, support of OS/2 in native mode, i.e. no wrappers like EMX, 16-bit calling conversion, SOM support via interfaces (like Win32 COM does, it's like DTS) and so on.

Nearest plans are: Tasks under the BIG question:
 * 1) Finish migration to Watcom tools
 * 2) Finish SOM Compiler Pascal Emitter
 * 3) Add support of DLL creation
 * 1) Lazarus port. Do we really need Delphi-like RAD?
 * 2) Odin32 target. Do we need transparent compilation of Win32 source under OS/2?

Downloading FPC
FPC/2 can be downloaded from Free Pascal site. Also FPC/2 available from the Hobbes file archive. Development build (not stable) can be obtained only from FPC site. Stable version exist only in EMX flavour. Development version as EMX and OS/2 versions.

Installing FPC
FPC/2 comes with installation procedure. You need only execute install.exe, fill entry fields (or leave them as is), select preferred set of features and... Enjoy. FPC/2 is here. Actually, exist some ideas about creating of PM installer, but no free forces for it as yet.

Conclusion
FPC/2 is mature but young project. Lot of tasks still open, but most of them trivial. FPC/2 has tasks of various difficult. As for mature developer as for beginner. Any help is welcomed.

In next article we'll explain how to download and compile FPC/2.