Free Pascal Compiler Review

From EDM2
Jump to: navigation, search

By Prokushev

Introduction

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 has some disadvantages. One of most known compilers is Virtual Pascal Compiler. Very good compiler with IDE. Good Borland/Turbo Pascal compatability with support of some Delphi-language extensions. But not so dynamically extended and improved nowdays. Sibyl compiler is another example. Good Visual Development environment (Delphi-like RAD), but too outdated and not developed anymore. On another side we have good open source, contantly 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 & eComStation. At the present time OS/2 version exist in two flavours: EMX and OS/2. EMX is first OS/2 version of FPC. Nowdays EMX not so good supported as native OS/2 version. Native OS/2 version of FPC still uses EMX libraries to have access to 16-bit functions of OS/2 and EMX tools still used for compilation. At the present time Watcom tools support in work. Latest alpha/beta versions of FPC also contains 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 API's and lot of cross-platform packages. FPC is open-source project so any 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 internal assembler/linker.

FPC/2 at the present

OS/2 version of compiler 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 supported for other platforms. 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 whithout) 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 convertion (thunking). Smart-linking (no unused code in executables) doesn't work very well. Recently Free Vision (Turbo Vision reimplementation) was included in 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 lot of plans for FPC/2 in 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, ie no wrappers like EMX, 16-bit calling convertion, SOM support via interfaces (like Win32 COM does, it's like DTS) and so on.

Nearest plans are:

  1. Finish migration to Watcom tools
  2. Finish SOM Compiler Pascal Emitter
  3. Add support of DLL creation

Tasks under the BIG question:

  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 preffered 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 are welcomed.

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