[fpc-pascal] Library packages

Sven Barth pascaldragon at googlemail.com
Mon Oct 28 11:14:25 CET 2024


Adriaan van Os via fpc-pascal <fpc-pascal at lists.freepascal.org> schrieb am
Mo., 28. Okt. 2024, 08:27:

> Can someone tell me what the status is of Library packages, aka "Delphi
> packages" ? I found the
> WIki <https://wiki.freepascal.org/packages> but it looks like a
> preliminary document.
>

Compile time usage of dynamic packages is implemented and is in theory
working for all darwin targets, the Windows targets as well as
x86_64-linux, however the functionality is not yet enabled by default,
because the build system can not yet generate the packages required.
What is missing is support to load additional packages at runtime.


> My questions
>
> 1. For MacOS, are there any differences at the Mach-O level between a
> dynamic library and a library
> package ? Are different linking switches used ? Which ones ?
>

Dynamic packages are essentially normal libraries. I'm not aware of any
special options used compared to ordinary libraries.


> 2. Are there any differences at the FreePascal RTL level ? What compiler
> building options govern this ?
>

The main difference is that a program or library compiled without dynamic
packages will each have a statically linked copy of the RTL (and any other
code it uses). If a binary uses dynamic packages then the binary itself
will not contain code that is contained in one of the used runtime
packages. Binaries are relatively free to decide which packages it uses,
except for the RTL package which always must be used if packages are to be
used (because the core units like System then need to recide in a separate
library, so that other packages and the main binary can use them).
The options involved are -Fpxxx to set the path to search for pcp files
(the metadata equivalent of a ppu for dynamic packages) and -FPxxx to
specify which packages to use.


> Probably there are differences for Lazarus too, but my first interest are
> the low-level changes.
>

Lazarus currently does not support dynamic packages, because for Lazarus to
profit from this, loading at runtime needs to be implemented.

Regards,
Sven

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20241028/3c9e1247/attachment.htm>


More information about the fpc-pascal mailing list