The Free Pascal Compiler (FPC) and the Lazarus IDE—an open-source development environment for Pascal—have released a major update introducing full dynamic package support. This functionality allows developers to create and install components, controls, and IDE extensions in seconds. Previously, significant changes to these elements often required a full rebuild of the IDE or the entire application. With dynamic packages, these components can be loaded and updated at runtime, facilitating a more modular plugin system where native Pascal classes and types are exposed through dynamic package libraries.
To achieve this, the development team implemented extensive improvements to the compiler, the runtime library (RTL), and the Lazarus IDE. The new system uses standard shared library files for Linux, Windows, and macOS, which include specialized metadata generated by the compiler. The runtime now includes mechanisms to safely manage dynamic types—such as strings and dynamic arrays—and preserve thread variables across different package boundaries. A new RTL unit, `DynPkgTypes.pas`, was added to help developers inspect and query the contents of these packages, including their RTTI (Run-Time Type Information).
While the update offers significant flexibility, it introduces specific technical constraints. For instance, a unit within a package cannot share the same name as the package itself; the compiler now automatically appends 'Package' to the source file name to prevent this conflict. Additionally, unit names must remain unique across all installed packages to avoid collisions. Because dynamic packages contain a comprehensive map of their internal contents, they are larger than standard shared libraries, and stripping these packages will break their dynamic functionality. These changes aim to modernize the FPC ecosystem, providing a more agile development experience for both IDE extensions and standalone software plugins.
