[fpc-devel] RTL make shared
Sven Barth
pascaldragon at googlemail.com
Wed Oct 30 11:11:39 CET 2024
Adriaan van Os via fpc-devel <fpc-devel at lists.freepascal.org> schrieb am
Mi., 30. Okt. 2024, 06:50:
> Sven Barth via fpc-devel wrote:
> > Adriaan van Os via fpc-devel <fpc-devel at lists.freepascal.org
> > <mailto:fpc-devel at lists.freepascal.org>> schrieb am Di., 29. Okt. 2024,
> > 15:47:
> > The idea of building the RTL in a dynamic ibrary is to have one copy
> > of the RTL threadvars, notably
> > one copy of the _ExceptObjectStack threadvar. Will this still be
> > true if a main program and a
> > dynamic library both include sysinit.o ?
> >
> >
> > The sysinit unit contains the entrypoint and directly references symbols
> > provided by the main program, not the RTL, to pass them into the RTL. It
> > simply can't be inside a library. The exception handling is inside the
> > System and SysUtils units, so no conflict there.
>
> sysinit.o contains _FPC_LIBMAIN and thus has to be linked in when creating
> a dynamic library
> compiled with FPC. The crucial question is — do we then end up with one or
> two copies of the
> _ExceptObjectStack threadvar ?
>
_FPC_LIBMAIN is for files with the header "library". Units moved to a
shared library don't have a need for that symbol, because they'll be called
from the main program.
And if you should have a FPC library then you need to make sure that it's
linked against the same shared RTL library to avoid issues. Only if a
library links in its own RTL there will be separate symbols instead of
shared ones.
Regards,
Sven
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20241030/059461eb/attachment-0001.htm>
More information about the fpc-devel
mailing list