<div dir="auto"><div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Adriaan van Os via fpc-devel <<a href="mailto:fpc-devel@lists.freepascal.org">fpc-devel@lists.freepascal.org</a>> schrieb am Di., 29. Okt. 2024, 15:47:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Sven Barth via fpc-devel wrote:<br>
> Adriaan van Os via fpc-devel <<a href="mailto:fpc-devel@lists.freepascal.org" target="_blank" rel="noreferrer">fpc-devel@lists.freepascal.org</a> <br>
> <mailto:<a href="mailto:fpc-devel@lists.freepascal.org" target="_blank" rel="noreferrer">fpc-devel@lists.freepascal.org</a>>> schrieb am Di., 29. Okt. 2024, <br>
> 11:29:<br>
> <br>
> Trying to build the FPC RTL as a dynamic library on MacOS (with make<br>
> shared), I run into several<br>
> problems<br>
> <br>
> <br>
> I don't know when that was tested last in any platform... <br>
<br>
Thanks for the reply.<br>
<br>
Isn't this related to library packages ?<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">No, not really. This is essentially forcefully moving code into a library and this only works on *nix platforms. With dynamic packages much more metadata is involved, because the runtime can then check whether packages are compatible. </div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
> <br>
> <br>
> 2. When I do the linking pass by hand, ld complains about unknown<br>
> symbols<br>
> <br>
> ld: Undefined symbols:<br>
> FPC_RESLOCATION, referenced from:<br>
> _TC_$SYSINIT_$$_SYSINITENTRYINFORMATION in sysinit.o<br>
> FPC_RESOURCESTRINGTABLES, referenced from:<br>
> _TC_$SYSINIT_$$_SYSINITENTRYINFORMATION in sysinit.o<br>
> FPC_RESSTRINITTABLES, referenced from:<br>
> _TC_$SYSINIT_$$_SYSINITENTRYINFORMATION in sysinit.o<br>
> FPC_THREADVARTABLES, referenced from:<br>
> _TC_$SYSINIT_$$_SYSINITENTRYINFORMATION in sysinit.o<br>
> INITFINAL, referenced from:<br>
> _TC_$SYSINIT_$$_SYSINITENTRYINFORMATION in sysinit.o<br>
> _PASCALMAIN, referenced from:<br>
> _TC_$SYSINIT_$$_SYSINITENTRYINFORMATION in sysinit.o<br>
> __stklen, referenced from:<br>
> _SYSINIT_$$_FPC_SYSTEMMAIN$LONGINT$PPANSICHAR$PPANSICHAR in<br>
> sysinit.o<br>
> <br>
> <br>
> sysinit should be part of the program, not the library. <br>
<br>
The idea of building the RTL in a dynamic ibrary is to have one copy of the RTL threadvars, notably <br>
one copy of the _ExceptObjectStack threadvar. Will this still be true if a main program and a <br>
dynamic library both include sysinit.o ?<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">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. </div><div dir="auto"><br></div><div dir="auto">Regards, </div><div dir="auto">Sven </div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote></div></div></div>