Settings

Theme

Free Pascal compiler now supports dynamic packages

getlazarus.org

144 points by sysrpl · 40 comments

Reader

14 threads
sysrplOP

I am pleased to announce the first release of full dynamic package support for the Free Pascal Compiler and the Lazarus IDE. This feature has been a long time coming for the FPC ecosystem and has taken more than 20 years to realize through the work of many FOSS individuals.

Dynamic packages allow programmers to create and install components, controls, and Lazarus extensions in seconds without rebuilding the entire Lazarus IDE. They can also be used in by Free Pascal programmers to develop and deploy plugins that expose native Pascal classes and types through dynamic package libraries. To support this functionality, I have made numerous improvements to the compiler, its runtime, and the Lazarus IDE. I have also created additional IDE extensions to improve the experience of working with Lazarus packages. Read more at the link above.

  • phba

    Awesome work. It's great to have a FOSS alternative while (Embarcadero) Delphi gets worse with every new release.

  • andsoitis

    Congratulations!

    Pascal/Lazarus/Delphi strike such a nice balance of responsiveness in the development lifecycle.

    • sysrplOP

      Thank you. This has been a long time coming, perhaps 20 years in the making. I realize people are moving on to newer languages and frameworks, but there is just something special about older versions of Delphi and now Lazarus that makes it so much easier to write desktop software than most other frameworks. You can just drop components on a form designer, press run, and in a second's time you have a program. Of course there is more to it than that, but with dynamic package support, users can make or use components even faster as they no longer need to rebuild the IDE to install or uninstall native code.

      • switchbak

        I was doing exactly that some 27 years ago for my first internship. It has been a disappointment ever since seeing how little many other environments have prioritized tight feedback loops. Outside of dynamic stuff, mainly.

  • pjmlp

    Congratulations on the achievement, and to everyone that made it happen.

    Similar to Delphi packages I assume.

  • throwaway27448

    Congratulations!

kristianp

This seems to be a fork of Lazarus. The official Lazarus is at https://www.lazarus-ide.org/

  • sysrplOP

    I have been running the website getlazarus.org for 13 years to support add features to both FPC and Lazarus that jump ahead of the normal releases. We have been working of dynamic packages for a long time, and there will be a period between now, and when it is sent as a MR back into the mainline. When enough time has passed and feedback given these features are typically rolled into the main release, and at getlazarus I move on towards developing the next features.

jan_m_savage

very excited for this, and thanks of course.

some of the greatest programming books in the world have been written with Pascal as their language.

ethin

I would love to use Lazarus, but the UI toolkit it uses has some very bad accessibility bugs that make it practically unusable with my screen reader. FreePascal's love of syntax diagrams is also a turn-off for me (I've always preferred things like EBNF or similar for grammar notation).

Perenti

I love Free Pascal. I've tried using claude/codex/qwen to write in it, but all the models seem to love writing uncompileable code, and ending up in fearsome knots over it.

It's my number one "knock something together that just works" language for humans though.

  • djriley

    That's interesting, I thought Claude or Codex would be really good with it. I've been doing some FPC/Lazarus work with Gemini 3.8 Flash, working on a program that creates STLs, DXFs, and SVGs of involute gears for machining or 3-d printing with a nice "Gear Designer" and visual preview and the code has been perfect. I enjoy building the UI and write the UI logic myself, but the exporters and gear calculations are beyond my capabilities and everything Gemini's done has been basically flawless. I have no dependencies beyond the RTL and LCL, not using any libraries to help with the format exports. Seem's like the opinion here is that Claude and ChatGPT do way better code than Gemini, so I'm surprised you've had issues.

    The only minor problems I've had is Gemini went through a phase where it was using semi-colons improperly in if statements, which is something everybody messes up with Pascal, so forgivable, I'm sure if I was using an agent rather than the web interface it would have figured it out from compiler errors right away. That and sometimes with UI stuff it would hallucinate methods or properties for components that are part of commercial delphi components, but I've only ran in to this 2 or 3 times.

    When I first started on this project I believe we were on early Gemini 3 and I will say it's handling of Pascal constructs was quite rough, it seemed to have a lot of trouble with the verbosity. Lot's of extra tokens to grok the structure vs something like C or Go. But from 3.5 onwards it's been flawless.

    Maybe it's just one of those things Gemini is simply better at. I'd much rather read Gemini prose than Claude, and Pascal is definitely closer to natural language than something like Rust might be. On the other end of the language spectrum I find it is incredibly good with Go as well, I think Google might have a bit of an edge as far as high quality training material for that language goes.

    • jan_m_savage

      Gemini 3.8 Flash as used inside Google's AI Studio is significantly better at certain tasks at which Claude Sonnet 5.5 is not. However, Flash makes more mistakes and needs more guidance.

      I sometimes use Gemini and then correct with Sonnet.

publlus_enigma

Well done to the entire team behind this!

I haven't programmed Pascal since the 90s, but I always appreciated the design philosophy and tools like Turbo Pascal for rapid development.

I find myself becoming increasingly disillusioned by many modern/popular languages, development methodologies and frameworks (particularly around interpreted languages lime JavaScript and Python), so I will check this out!

  • jan_m_savage

    It's truly is a pity the world didn't discover just how great the Pascal bloodline was. Modula-3 was as powerful as C++ but 75% less complicated/complex/annoying. Still is.

sizzzzlerz

Is Pascal used much these days. I learned it way back in the 80s since several of my MSEE classes used it. Professionally, I never used nor heard of it being used except for Apple. I'm sure it has evolved since the dark ages to incorprorate more modern programming techniques but with the wide range of languages available today and the fact that it is rarely taught anymore, why might some decide to use it on their project?

  • djriley

    I think Pascal, as in it's modern dialect Object Pascal used in Delphi and FPC/Lazarus is a sort of "hidden language". You won't see many big Open Source projects using it and there's only a handful of big commercial packages using it, but behind the scenes for domain-specific/in-house software it is used quite a bit. It allows small teams or individuals to very quickly put together software that is used by the business departments or engineering/technical with modern GUIs and good performance. It's exactly what it says on the package, "Rapid Application Development". Stuff like Rust and Go are great, but having to code out the entire UI by hand basically doubles the maintenance/development burden and requires a lot of knowledge about the widgetsets and their libs. QT Creator, Glade/Cambalanche, wxFormBuilder are nice, but there's a decoupling there that adds complexity and they all require C/C++ if you want native code. WinForms/WPF on .NET in Visual Studio probably come the closest to what you get, but it's mostly Windows specific and I wasn't able to pick it up easy like I was Delphi.

    FPC and Lazarus are really amazing tools. FPC itself is quite a competent compiler with many available platforms including legacy platforms, Java VM, WASM. Very fast compilation, run time perf is not quite C++ especially with strings, but fast enough. Even Lazarus LCL programs are quite lean and efficient for what they are. The RTL/FCL are comprehensive with tons of functionality, things like string handling, containers, math, all there and everything you expect.

    The killer app with Lazarus is it's cross platform GUI capabilities. The last release is still stuck on Gtk2, but trunk Gtk3 is default on Linux with QT5 and QT6 available, Cocoa, and Win32 and for the most part it just works. You build for GTK or Qt, you switch to Win32 and compile a native windows app. The RTL abstracts most of the OS stuff like file handling and threads, and the LCL handles the widgetsets. There's nothing else even close when it comes to cross platform development of desktop apps.

  • andsoitis

    Check out:

    - Delphi (https://www.embarcadero.com/products/delphi/features/delphi)

    - Lazarus & Free Pascal (https://www.lazarus-ide.org)

    - Oxygene (https://www.remobjects.com/elements/oxygene/)

    And since you remarked about "modern languages", have a look at https://castle-engine.io/modern_pascal

    • fithisux

      The truth is we need more expository articles like this.

      Silver Pascal coder is doing a lot of Pascal evangelism, but he is alone.

  • baq

    Yeah, it’s just called golang

  • veqq

    I've shipped a few things to clients with it in the past 5 years.

  • Perenti

    The FLStudio DAW suite is written in Delphi.

devilrider

Is that a virus-version fork? No source, no installer?

rurban

Anthony: Whats "dynamioc library support"? Is that a typo in the commit message?

HexDecOctBin

Last time I tried Lazarus, the strangest feature that FPC was missing when compared to Delphi was being able to declare variables anywhere (as opposed to only at the top of a block). FPC is still stuck in a very C89 model of declarations for some reason, perhaps that's just what happens when ecosystems stagnate.

  • sysrplOP

    That feature you mentioned was added by the Delphi team in support of closures. They way they developed it was jankey IMO, as it creates an interface behind the scenes and populate with information about the local stack.

    Though I do very much appreciate C#, with its lambda functions, expression trees, and especially the tooling, Free Pascal and Lazarus exist as a happy compromise between those things and native code integration, where working with C libraries like libcairo, libxml2, libssl, libsdl, and opengl are much easier and a pleasure to work with when using Free Pascal, and conversely are more difficult to wrangle when using C# or Java.

    • wk_end

      All OP is asking for is the ability to declare variables at first use instead of at the top of a function. You don't need closures or anything that'd inhibit C compatibility for this - C itself has supported this since C99. It's fairly simple if you're willing to give up single-pass compilation, which (I think?) FPC already has.

      • trashface

        Could probably just get the source and have an LLM vibe code that, for personal use seems fine.

yonisto

Congratulations! This is a great achievement.

How do you handle base address assignment on windows?

fithisux

It may find its way into MoonCompiler, if not already there

https://github.com/Moonbot-Tech/MoonCompiler

Pompidou

Good Thanks.

ironqcold

Good job

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection