[fpc-pascal] Mixing PIC non-PIC code/variables when linking a shared library

Dmitry Boyarintsev skalogryz.lists at gmail.com
Mon Nov 17 05:04:17 CET 2014


Hello Fpc-developers,

Why would a global variable cause an issue when linking a shared library
(specifically 64-bit linux)?
The more detailed description is here:
http://bugs.freepascal.org/view.php?id=17412

Linker fails to generate an .SO file complaining about a bad code generated
for:
TC_RICHMEMO_RTFLOADSTREAM
Where RTFLoadStream is declared as:
var
  RTFLoadStream : function (AMemo: TCustomRichMemo; Source: TStream):
Boolean = nil;
The variable doesn't seem to be exported by the library in any way.
Are global variables treated in some special manner when generating shared
library?

To add to that. RichMemo comes as Lazarus package.
Thus object files for it are compiled without -fPIC flag set, by default.
However, it's possible to recompile the page with -fPIC flag later (that
should resolve the issue named in the bug report)

thanks,
Dmitry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20141116/2608e623/attachment.html>


More information about the fpc-pascal mailing list