
Lazarus and Free Pascal Gain Full Dynamic Package Support
The first release of full dynamic package support for the Free Pascal Compiler and Lazarus IDE is now available, letting users install components and controls in seconds without rebuilding the entire IDE.
The first release of full dynamic package support for the Free Pascal Compiler and the Lazarus IDE is now available for download. The feature lets users create and install components, controls, and Lazarus extensions in seconds without rebuilding the entire IDE. Dynamic packages can also be used in custom programs to develop and deploy plugins that expose native Pascal classes and types through dynamic package libraries.
Package Format and Runtime Support
Dynamic packages are implemented as standard shared library files for Linux, Windows, and macOS. They contain additional metadata generated by the compiler, which can be inspected and queried using new RTL units. The runtime includes mechanisms for safely preserving thread variables and managing dynamic types, such as strings and dynamic arrays, between programs and packages or between multiple packages.
When deploying a program, developers can still bundle everything into a single executable, or divide it into multiple dynamic packages that can be replaced while the program is running, providing a plugin system.
A unit in a package cannot share the package's name, so the package system now appends the word Package to it. A package called ElectroTools.lpk, for example, generates ElectroToolsPackage.pas instead of ElectroTools.pas. Unit names must also be unique across packages. Dynamic packages are larger than ordinary shared libraries because they contain a map of everything inside them, and stripping removes the metadata required for them to function.
The runtime library adds a TPackageType record and a new unit, DynPkgTypes.pas, for reading information from dynamic packages. The RTL provides functions for loading, enumerating, searching, and unloading packages at runtime.
Lazarus IDE Enhancements
A new progress window can appear outside the IDE. When source code belonging to a registered package is modified, the system detects the changes and rebuilds the package before Lazarus starts. The window shows the current operation and the estimated time remaining before the IDE restarts. It also appears when adding or removing packages takes more than five seconds, including when installing multiple packages at once.
A new Packages window, docked on the right by default, lists recently opened packages, and the list persists between sessions. Files within a package can be browsed and opened with a double click. When an installed package is compiled, its controls, components, or extensions are updated within a second or two.
The package menu now updates the IDE when packages are added or removed, without requiring a rebuild. Package options under IDE Integrations allow a package to be restricted to a specific platform or widgetset; a package that does not meet the current requirements will not appear in the package list.
A new form or frame conversion feature turns any form or frame into an installable control added to the component palette, with all controls, events, methods, and properties copied. If a package is being built while an open form uses it, the IDE asks to save or close the form first.
Availability and Support
All installers include dynamic package support. The changes to FPC and Lazarus are committed to GitLab in forked branches named dynamic packages. Problems can be reported through the GitLab issue tracker, and questions can be discussed in the project forum. The project is also seeking moderators and an M1 Macintosh donation to help produce macOS builds.
Sources: getlazarus.org
SiTech — AI-powered web development
We build fast, modern websites and bring AI into real business workflows. Have a project or a question? We'd love to help.