Second Impression of Lazarus/FPC

I finally had a few hours to work on hcOPF support for FreePascal which I had started some time ago.  I downloaded the Lazarus 1.0.10 installer and ran it in my development VM.  Then I continued creating new FPC projects, attempting to mirror the Delphi ones.  What I found, is that as a Delphi developer, the combination of Lazarus with FreePascal is far from a seamless transition if you are trying to migrate a framework.  There are numerous unit differences and the FreePascal compiler has significant differences from Delphi’s compiler even in Delphi compatibility mode.  The way Lazarus handles package projects is different, as are all GUI dialogs for the compiler paths and conditional defines, and even the IDE windowing.  It all takes a little getting used to.

The compile cycle seems to be longer using Lazarus, and the debugging tools are IMHO much more primitive than Delphi.  For instance, you cannot evaluate expressions such as Person.AttributeByName(’FirstName’).Value like you can in Delphi. The debugger visualizers are also quite a bit different from Delphi.  Due to an incomplete port, the IDE crashed while tracing the code with a 219, resulting in an empty LPI file for subsequent runs.  On the plus side, it loads SO much faster than XE4, being almost instantaneous, that such crashes aren’t a real impediment and I’m sure are an unusual situation.

Of course I miss having GExperts and cnPack functionality.  It’s unfortunate that no other IDE exposes the same OpenTools API interfaces used by such projects, so a developer could take them along.  I also really liked the CompBar substitute for the D7 component palette, and if I could install CodeRush for D7 in Lazarus I would be sold ;-) .

There are a lot of little differences, but a lot of the time, it’s simply an issue of getting familiar with the IDE.  For instance, it took me a while even to figure out that Delphi’s Browse Back/Forward is called “Jump Forward/Back” in Lazarus and was mapped to different keys.  I remapped them (try that in Delphi) to use Alt+Left Arrow/Rt. Arrow and I was happily drilling through the code again.

The demo I am working on porting uses a Firebird database with the IBX connectivity layer.  After looking at all the Lazarus database examples I had decided that it was going to be a longer porting effort until I ran across the IBX port from MWA Software.  I downloaded and installed it, and suddenly I could use my datamodule from Delphi without a problem. I thought I was home free, until I found I needed to install some design-time code into the IDE and I couldn’t resolve “Designer.GetComponent(Value)” in a TComponentProperty editor.

I will continue working on my FPC port as time permits.  Lazarus is truly an impressive IDE with some nice features such as closing All Other Pages in the editor.  I am sure as I spend more time, I will discover many other tools made by developers for developers (not a marketing department), and I really like the back to basics, no fat approach.  It’s as close to having an open source version of D7 as we will ever get.   It is also nice to be able to choose your UI Widgetset instead of being locked into a proprietary vendor solution.  What is equally as impressive is how the open source community is developing viable technologies for iOS and Android in addition to the impressive OS list that the Lazarus/FPC combination could already target.

If you are interested in learning ObjectPascal, or targeting Linux or Mac OS/X with 64 bit native code, or even considering Android/iOS development, the no cost, open source, Lazarus/FPC combination is worth a look.

7 Responses to “Second Impression of Lazarus/FPC”

  1. Wodzu Says:

    IMHO what Lazarus is missing is their own debugger written from scratch.
    Probably the primitiveness of debugging tools you’ve mentioned is caused by this fact.

  2. Giel Says:

    For the record: if you rightclick a tab in the Delphi IDE there’s an option to close all other tabs.

  3. Larry Hengen Says:

    @Giel,

    Yes I realize that. It’s only in recent IDE versions, prior to that AFAIK you could get that functionality using CnPack. I have no idea how long Lazarus has had that feature. My point is that the feature set is determined by the developers working on the project and the community requests, so there is bound to be lots of those little kind of “nice to have” things in Lazarus. By contrast, look at the backlog of QC reports and you can kiss all the “nice to haves” goodbye even if you can convince EMBT that it actually should be done.

  4. C Johnson Says:

    If you have to use Lazarus, go grab CodeTyphon. Not only will it make installation sane, but you get a HUGE pile of components.

    http://www.pilotlogic.com/sitejoom/index.php/codetyphon

  5. Sven Says:

    If you have code that compiles in Delphi, but does not compile in FPC’s Delphi mode it would be nice if you’d (1) test whether this was already fixed in the current development version and (2) report a bug at http://bugs.freepascal.org if it isn’t. We can not test every Delphi code under the sun and while there are a few intentional differences that won’t be fixed most Delphi code *should* compile and if it does not it’s a bug. The same goes for bugs in the LCL of course, though there might be more compromises.
    Also regarding databases I’d suggest you to take a look at SQLDb which comes with FPC: http://wiki.freepascal.org/SQLdb_Programming_Reference

    Regards,
    Sven
    FPC compiler developer

  6. Markus Ja Says:

    Great Project. Similar current Delphi IDE for Lazarus:
    http://sourceforge.net/projects/kzdesktop/

  7. Volker Says:

    CodeTyphoon needs a 2GHz Cpu. This is not acceptable in times of multi kernel CPUs, where you can distribute the prozessor power into the kernels.

Leave a Reply