Sat, 06 Feb 2010

Lazarus

I've been a user of Delphi for quite a few years now, mostly in it's C++ Builder incarnation. Because of this (my "C-weenieness") I've not done a tremendous amount of coding in Object Pascal, But I have done some, mostly at a very low level in components and libraries as the base (the Visual Component Library or VCL) of C++ Builder is all written in Delphi Pascal.

I noted with some interest last year that Codegear was working on a cross platform product, bringing Delphi to the Mac (and back to Linux). This was pretty exciting to me, because there's an increasing pressure at work to develop Mac solutions (and I'm sure they'll catch on to Ubuntu eventually). This would be an ideal solution, as it would leverage our existing codebase to new platforms.

The problem is that Codegear is taking their sweet time. And we needed a solution now - products have to ship! And I found a solution - Lazarus.

This isn't a "write once, run anywhere" environment (like Java promised to be), nor is it a cross compiler (exactly). It's a "write once, compile anywhere" RAD IDE for Object Pascal, with a component library that mimics the VCL but ties to an underlying widget set that's platform specific. Carbon (and some Cocoa) widgets are supported on the Mac, QT and GtK on Linux platforms and Win32 (or WinCE) on Windows. Processor support includes PowerPC, Intel and ARM. And it works.

I can write a program on a Windows box that compiles on my Mac - and on Windows it looks like a Windows app, and on the Mac it looks like a Mac app. There are a few platform specific ifdef's in the code, to be sure, but remarkably few. Most of the OS dependent stuff is handled transparently under the hood, including the crazy stuff like path separators for file access. It's really quite amazing.

I'm finding myself becoming quite enamored of the language itself, too. Sometimes my fingers move faster than my brain (especially on things like the equality operator - in Pascal, it's := as opposed to just =, which is the comparison operator) but overall the syntax is strikingly similar to what I've been doing with C++ Builder. This is mostly due to the nature of the underlying framework.

The developers of Lazarus have done one heck of a job with the LCL (Lazarus Component Library) and the FCL (Freepascal Component Library). These do much more than merely mimic the VCL - they extend it in very logical and useful ways. Unicode support, graphics support, even compression support are all built in. It's actually fun to write code in this thing.

And they did a smart thing with licensing, too. While the IDE and compiler are GPL, the frameworks and libraries are all LGPL. Which means no restrictions on us in commercial programs.

In short, I'm throughly impressed. If you need a cross platform dev tool, don't let the "Old School" rap of Pascal put you off. Check out Lazarus - you'll be amazed at what's possible today.

/Technology | 1 writeback | permanent link


On 7/7/2010 08:31:16
Jose Torres wrote

Glad to found your note


comment...

 
Notes: If you put a <mailto:> link in the URL field your address will not be mangled: this could be a bad idea as your email address could be easily harvested by bots designed for SPAM. The comments field should now format correctly for line feeds and carriage returns: when you hit the 'Enter' or 'Return' keys in your comment it should break to a new line. The text should wrap cleanly. Please let me know if it doesn't. No HTML tags will pass through - entering links seems to be the main cause of comment SPAM. Also, please be sure that Javascript is enabled in your browser before attempting to post a writeback. Sorry for any inconvenience, but this really helps cut down on the amount of comment SPAM I have to deal with.
 
 Name:
 URL:(optional)
 Title: (optional)
 Comments:  
Save my Name and URL/Email for next time