Lazarus Release 4.0

1 month ago (forum.lazarus.freepascal.org)

Best part: a hello, world GUI app (a dialog with a textbox and a button that pops up a message box) is ~2.5 Mb on Win32.

This was something like 500 Kb back in 2000, but it's still a far cry from your ~200 Mb Electron hello world.

  • I remember some years ago that I was able to make this less than 1mb. It needed a little tweaking like upx but nothing very complex.

    Lazarus should have been the golden standard for creating desktop apps. Every other solution I've tried is subpar either in licensing or costs in general, executable size and resource usage, non native components, extra dependencies etc

    • I think unfortunately what holds Lazarus back is the Pascal programming language. Although it is a very capable language that can hold its own against other languages, it suffers from a reputation of being obsolete.

      It’s a pity that the C family of languages won out over Wirth’s languages. Pascal’s superior string handling alone would have saved us from countless security flaws.

      4 replies →

  • > it's still a far cry from your ~200 Mb Electron hello world.

    I think that projects that ship packaged web apps but attempt to use the system native web views where available are really nice, like Wails: https://wails.io/ (so for example, on Windows it would use Webview2, so you don't have to package an entire Chromium install yourself)

    Here's a comparison of how the distribution sizes change, Wails in particular also has way faster builds than something like Tauri: https://github.com/Elanis/web-to-desktop-framework-compariso...

    That said, I wish we got more native software, or even something like LCL that can target Win32, GTK, Qt or whatever else is available. Sure, writing components that are available on a lot of platforms and work similarly everywhere is a pain for the developers, but I applaud the effort regardless, since the above solutions like Wails don't actually do anything for the memory usage and CPU cycles, whereas native GUI software is better for most apps that don't try to be very interactive.

    I could even see myself using Lazarus/Pascal more if it seemed to have a more active ecosystem, right now I couldn't tell you what are the equivalents of something like Spring Boot for webapps, or even consuming Web APIs in client software, handling OAuth2/OIDC/JWT, seems like mORMot 2 would fit the bill the closest?

    • As I understand, the main problem with native web views is that you now have to deal with all the inconsistencies of e.g. Blink vs WebKit. Also, browsers tend to be more aggressively updated, which translates to potential app breakage due to bugs or deprecated features.

      With respect to Lazarus, I agree that the ecosystem around it is not exactly great. It would be interesting to see LCL ported to something more modern that is reasonably simple, cross-platform and has good tooling. E.g. Go, much as I dislike it as a language, would probably be a great fit for something like that. And Pascal being fairly conservative and easy enough to parse, I suspect you could even automate this translation for the most part.

      1 reply →

  • 2.5 MB is for most of the Lazarus Component Library (LCL) with minimal size increases even as program complexity grows. For example, Dadroit JSON Viewer EXE is less than 6 MB while having complicated tree views, JSON handling, networking, and more. By the way, an empty CLI EXE on Windows is less than 50KB.

  • Best part for me that it's a single file executable. I chose to do a thing in Pascal last year just because of this one killer feature. I made some initial attempts to achieve this with something else but I didn't find any modern tool that could do that without some weird, sometimes involved, sometimes straight up experimental steps.

    • I think Go will do it, but I indeed enjoy Free Pascal for this as well. It's also nearly trivial to set up cross compilation using FPCUpDeluxe, so I've shipped applications to clients on Windows when I do all development and compiling on GNU/Linux.

    • .NET can create self-contained executables pretty easily (via _dotnet publish_), both including the required framework assemblies and without them. But they'll still be comparatively large.

      12 replies →

  • Maybe you're the person to ask. My Python Qt app is sluggish when it loads tens of thousands of values from SQLite. Various variations of pagination and lazy loading hurt usability. But isolating the issue and testing with C++ and Rust show that those two languages don't have the performance hit of Python.

    I could use C++ and stick with Qt, but I'd much prefer Rust. Rust has no good Qt bindings. What are my options?

    The app makes use of QV/HBoxLayout, QWidget, Qdialog, QPushButton, and other really standard features. It reads from the filesystem, reads and writes to SQLite, and outputs sound from mostly ogg files at various speeds (through VLC behind the scenes). I stick with Qt because I like how it integrates with KDE and other desktops flawlessly.

  • More generally, which all tools that can target multiple platforms, produce relatively small binaries for simple applications? And which of these are lean themselves?

    May be I am doing something wrong, but I had installed Android Studio, then Android emulator, SDK, etc., and before I could get a hello-world app to compile, some 30 GB were gone from my disk space.

    If it comes to it, I do not personally mind using multiple tools and code for different target platforms, as much as (a) both the tools themselves and the binaries generated are lean, and (b) the development tooling itself is on a single platform just so that I do not need to maintain multiple hardware. (I currently use Windows, would likely need to move over).

    Thanks.

  • Who remembers Steve Gibson's 'little corner of the web'? He wrote super small Windows applications in assembly: https://www.grc.com/smgassembly.htm

  • That’s a lot. I don’t know the specifics of Lazarus, but this typically screams static linking with everything and the kitchen sink being thrown into this one binary. Entire cross-platform runtime, GUI assets, metadata, etc. Could be a fat debug build, too.

    • It was the common complaint about writing VCL apps in Delphi - that single message box app would be 0.5MB binary.

      But that was the static overhead of VCL core library and the benefits were considerable compared to writing raw WinAPI.

      And unlike MSVC 16kB WinAPI executable you didn't have chance of sudden surprise "oh, but you need to update msvcrt.dll to run this" because Delphi (and Lazarus/FPC) default to statically linking the runtime

    • That's indeed a statically linked binary. Release, with smart linking (so only things that are actually used are linked; otherwise it'd be ~20 Mb), debug symbols stripped. Measuring .exe size when linking dynamically would kinda defeat the purpose of the experiment, since you'd still need to distribute the DLLs to the users for any real world app.

  • But if you don't target windows, but the web as target plattform, you will need just 53 bytes that will work, wherever a browser works.

    <input type="button" onclick="alert('hello world')" />

  • Can't you still do much the same with WinForm, or maybe GTK?

    • With WinForms you can do much better, in large part because .NET itself ships with Windows and thus the app can just rely on it being there, but also because C# compiles to bytecode rather than native code (so it's not exactly a fair comparison). Anyway, the identical hello world GUI app in C#/WinForms is ~11 Kb.

      With Gtk, no, because it implements all widgets by itself rather than wrapping Win32, so it'll necessarily be larger. Also, statically linking it can be a pain (and AFAIK isn't even supported in Gtk 4 anymore).

      2 replies →

  • Is that statically linked or dynamically link? If the later, does it include all the libraries and assets it uses?

  • Does it have dark theme support and does it sync it's theme with the system one?

    • Not with the Win32 backend, since those widgets themselves don't have that notion.

      Qt backend should be able to do that, though (but then of course you need all those Qt DLLs).

      4 replies →

Lazarus and Open Pascal is fun!

And so it drives me crazy to see the state of their documentation. The wiki needs to be archived and replaced with a coherent documentation platform. It’s such a turn off. The whole website is a SWAG site frankly.

‘ SWAG sites

SWAG is an archive of tips and example programs for Turbo Pascal/Borland Pascal and early Delphi. Much of it is still applicable to today's Object Pascal - and much is obsolete...’

How can a language compete when a new user sees this?

  • > It’s such a turn off.

    Is this the wiki you somehow want to have removed? https://wiki.freepascal.org/

    It seems perfectly fine, information-dense even which is even better. Seems a lot better than the typical one-long-landing-page-docs many languages have today. What exactly is the problem with the wiki that cannot be fixed and must be re-made from scratch?

    • The wiki is full of incomplete, obsolete, or otherwise not-so-useful articles. It suffers from typical "wiki as documentation" efforts, where instead of concentrated efforts from domain experts, you get a thousand half-baked opinions.

      It has good stuff, but I'd wager the "bad stuff" outweighs it by a large margin.

    • Thank you for your response and your example.

      The problem is optics. Pretend I'm a brand new user and I want to build GUI applications. I've heard of a language called Freepascal and of an IDE called Lazarus. I think they're connected but I don't know how. And what's Delphi?

      Where do I start?

      ? Welcome to the Free Pascal and Lazarus Wiki [2] https://wiki.lazarus.freepascal.org/

      ? Lazarus Documentation https://wiki.freepascal.org/Lazarus_Documentation

      ? Welcome to the Free Pascal and Lazarus Wiki [1] https://wiki.freepascal.org/

      ? https://www.lazarus-ide.org/

      Most IDEs and languages have a Documentation link. Which link do I use to start with?

      FreePascal has lazarus docs and Lazarus has FreePascal docs?

      As a new user I can slog through 4 different links of schtuff, I guess. (Disappointment and frustration lie ahead; broken old buggy software that doesn't match the documentation. New User doesn't know that yet.) Maybe I'll just look for Youtube videos, but my enthusiasm is draining.

      I'm used to this:

      https://go.dev/doc/ Everything linked from go.dev/doc works today and it's coherent. Everything.

      As other responses mention, the docs as a rule are out of date and confusing.

      [1] btw redirects to [2] from search engines.

  • > And so it drives me crazy to see the state of their documentation.

    I talked about this in my article about the release:

    https://www.theregister.com/2025/05/09/new_lazarus_4/

    • The only relevant part I can find from that article is:

      > One criticism we've seen of the FreePascal project in general concerns its documentation, although there is quite a lot of it: eight FPC manuals, and lengthy Lazarus docs in multiple languages. There is a paid-for tutorial e-book available, too.

      The criticism is that there is too much documentation available? And they're long, and dare even to be available in multiple languages?

      4 replies →

  • I stopped using the Lazarus documentation a year ago when the AI prompts (which seem to be trained on the actual documentation) became easier and faster to use.

    Also AI also seems to get above average results with pascal code generation IMHO.

    • Interesting, which AI system are you using?

      This doesn't match my own experiences, I've tried a few times to ask about Pascal and the results have always been appallingly bad. From nonsensical syntax (sometimes mixing in C-style syntax), to made up unit and object names, I'm surprised if it can even manage a correct "hello, world".

      By comparison, Python generation can be pretty decent (not that it can't run into the same issues, but it is less frequent). I always assume it's because Pascal's online presence is gravely reduced compared to other languages. It is still a fairly popular language, but I'd wager most Pascal written is not published online.

      1 reply →

Lazarus is still my favorite when developing desktop apps.

Language is not a problem. Pascal is just C/C++ in another favor. LCL/VCL is a wonderful library, everything just works like what I am expecting.

  • I had a client habing trouble with and old vb6 software they where using in production. Replaced it with a lazarus app, and been running for 10 years now without problems.

  • Pascal is more ALGOL than C

    • ALGOL-60 was huge, in around 1960. Niklaus Wirth had a detailed proposal for the next version of ALGOL, to be called ALGOL-X.

      The ALGOL committee rejected it, choosing a competing and much more complex language headed by Adriaan van Wijngaarden. This became ALGOL-68 -- and killed ALGOL.

      Wirth took what was known as ALGOL-W and turned it into Pascal.

      FWIW I wrote about this:

      https://www.theregister.com/2024/01/04/niklaus_wirth_obituar...

      https://www.theregister.com/2025/01/07/algol_68_comes_to_gcc...

      Another offshoot of Algol-60 was CPL, intended to be more general-purpose and capable. But it was big and hard work to get it working.

      So Martin Richards designed, a simpler intermediate version, BCPL. (He also built an OS in it, TRIPOS. This formed part of AmigaOS 1.x.)

      BCPL was further stripped down to B, and then evolved into C.

Obligatory https://castle-engine.io/modern_pascal

  • > To return a value from a function, assign something to the magic Result variable. You can read and set the Result freely, just like a local variable.

    I'm torn about which is clearer, that magic variable style or assigning to the function name as one does in VBScript. I guess the magic variable makes refactoring dirty fewer lines

    I also have mixed feelings about golang's `func Doit() (result int, err error)` syntax. To quote another platform, "there should be one, and preferably only one, obvious way to do it"

    • I'll often use `result` as the return value in other languages, largely because I learned it in Delphi 25 years ago. It doesn't have the automatic return value semantics elsewhere, so you also need `return result` or whatever, but it's crystal clear what the intent is. I prefer it for that reason alone.

      1 reply →

    • `Result` is clearer given that in Pascal, a function name by itself in any other context is a function invocation (with no arguments). That is, you then have this kind of stuff:

        type PInteger = ^Integer;
        var X: Integer;
      
        function Foo: PInteger;
        begin
          Foo := @X;
          Foo^ := 123;
        end; 
      

      The first assignment here is assigning to the magic result variable, while the second one recursively invokes the function and dereferences the returned pointer to assign through it. This is technically not ambiguous (since you can never have a naked function call on the left side of the assignment, unlike say C++), but it's a subtle enough distinction for human readers. No such problem with `Result`, obviously, which is presumably why it was one of the things that Delphi added since day 1.

    • > I'm torn about which is clearer, that magic variable style or assigning to the function name as one does in VBScript.

      That's also "old style" Pascal, and still supported by Free Pascal (even though the compiler gives you a warning for doing it!).

    • >I also have mixed feelings about golang's `func Doit() (result int, err error)` syntax. To quote another platform, "there should be one, and preferably only one, obvious way to do it"

      Isn't it basically equivalent to an anonymous tuple which is automatically deconstructed on assignment?

      2 replies →

I only toyed with Lazarus/Free Pascal. There was some things I couldn't get used to. Maybe time to toy around again :) I feel like mentioning a few things that helped in the past: fpcdeluxe for installing a build of fpc and lazarus and a plugin called anchordockingdsgn to get all the floating windows in one window. It would be nice if 4.0 defaulted to that. The Castle Engine Pascal tutorial was actually pretty good also (which is mentioned in another thread here.) (edit: for the plugin, I see an option in fpcdeluxe to dock all windows - so it's possible to build that plugin in initially.)

  • fpcupdeluxe is great if you want to get a particular revision or build cross-compiling. If you need a stable version, just download the setup from. The docked IDE is the default option for this version.

It took way too long to figure out what Lazarus is based on their own website. Only found out because somewhere some random post said "Lazarus IDE".

  • I believe you are referring to their community forum. The link to "their own website" is in the left sidebar.

It is a pity that Lazarus and FPC seems to be so hard to deploy. It is of course an open source project, so its understandable.

Lazarus and FPC is a great project. Building GUI apps like with Lazarus does not have an easy alternative, from which I'm aware.

I have tried it now on my Mac, and I have to jump through some hoops to get it going. Again a pity, its a great option.

  • That's one problem I haven't had. I've even run Lazarus on a Raspberry Pi Zero W, it was slow but it actually worked. I don't know what kind of hoops the Mac has, but on Windows or Linux it's easy peasy.

  • I tried it and I can tell you that it's a lot easier with Lazarus 4 than it was with Lazarus 2.

It would be great if release announcements like this always included a description of what the product actually is.

>Lazarus is a Delphi compatible cross-platform IDE for Rapid Application Development. It has variety of components ready for use and a graphical form designer to easily create complex graphical user interfaces.

  • HN submissions don't have a field for description. And you are supposed to use original title. And there is a length limit on title. And some angry internet user will make a comment - sometimes even the submitter.

    • Yeah, technically you could add text with the link submission, but it will demote the link somewhat and I guess is just frowned upon here.

  • Delphi and Lazarus have been around for decades. It's like asking what lisp is.

    • Since I read about the guy who was surprised that anything other than SPAs exist (the full page reload magic incident), I realized there are way younger people in the field with no context or knowledge of CS history whatsoever, so some of them not knowing about Lazarus or Delphi sounds totally plausible.

      3 replies →

    • I have also met people who have to ask what Lisp is. You might be surprised at how many people don't know things like this.

    • I know Delphi, yet I didn't know Lazarus until now. I'm sure there are others like me.

      I can understand not wanting to explain Delphi, but come on, not everyone knows the name of every IDE for every language. It doesn't hurt to add one sentence explaining that. If I hadn't seen the comment above, I wouldn't be able to consider Lazarus in the future if I ever use Delphi again.

      7 replies →

    • > Delphi and Lazarus have been around for decades. It's like asking what lisp is.

      No.

      Everyone thinks their pet project is obvious and self-explanatory.

      This is NEVER EVER a safe assumption. Remember that our entire industry is a mysterious black box to the outside world.

      I worked for A Prominent North American Linux Vendor for a while. I was hired to work on the docs for one of their projects.

      I'm an industry veteran with at that time over 25 years of broad cross-platform tech experience from CP/M to Linux to mainframes.

      It took me a month of hard digging to get an extremely vague overall concept of what the product was and did.

      Most of the company had no idea -- it's not Linux-related in any way -- and many of them regard the entire product platform as an evil to be expunged.

      This is typical for that vendor. Aside from their Linux distro, ask for a tweet-length summary of any of their portfolio, expressed in general terms not specific to that product or vague marketing-ware, and nobody in the company can give it.

      Nonetheless they are a multi-billion-dollar vendor.

      But they only sell into established markets.

  • It's a link to a whole forum purely focused on that IDE, with it's name in domain name.

    Why would they explain that to their audience? They know.

  • I think you'd have a larger impact if you convinced other communities, like the Linux kernel or Xfce, that their "products" ought to have a note like that in their release announcements.

Nice to see this, and I jumped on it immediately since I really wanted to do a minimal form-based UI to a tool I'm building, but on macOS I keep getting linking errors when compiling (on a fresh install, on a machine that never had Lazarus before).

I guess I'll wait for the next minor.

  • Run Windows or Linux in a VM on macOS, and Lazarus in that VM?

    Also, is there no binary installer for macOS on the Lazarus site? Just asking. Don't know if there is one.

This was the name of a sadly gone Firefox extension that saved all your form field values automatically

  • Wow you just triggered a memory. I absolutely remember that plugin and it saving me a few times.

Have people tried combining it with better-supported languages like Python or Go or Rust, leaving only the GUI to Pascal? Any guides out there?

  • https://github.com/ying32/govcl is a binding of the Lazarus LCL GUI library to Go. It works pretty well, although I really got the impression that GTK2 and Win32 were the best supported targets, anything more modern was pretty buggy, so don't rely on it for hidpi support.

  • > Have people tried combining it with better-supported languages like Python or Go or Rust, leaving only the GUI to Pascal? Any guides out there?

    I do it with C, using opaque pointers for C objects. Painless because everything is statically compiled in.

    If you want a more dynamic solution (i.e. Python), you'll need to find a way to link every component in (or at least the ones your Python would use).

> Windows: 2k, 32 or 64bit, Qt, Qt5, Qt6 (64bit only)

Besides Qt, does it have a pure Win API back-end as well?

  • Yes. Try the IDE itself; on Windows it is built with Win API. PeaZip is a sample of it https://github.com/peazip/PeaZip

    • Ok, using WinAPI means it is not easily theme-able, unless they provide custom set of controls. I assume it is possible to use Qt back-end for Windows as well. I wish Lazarus also supported C++ akin to C++Builder. Pascal is a deal-breaker many.

      1 reply →

  • Yes, Lazarus has a native Win32/64 widgetset (LCL-Win32) that directly uses the Windows API without Qt dependencies.