[fpc-pascal] Re: Stack checking in dynamic libraries

Jonas Maebe jonas.maebe at elis.ugent.be
Sun Nov 8 19:54:54 CET 2009


cobines wrote on Sun, 08 Nov 2009:

> I have to conclude that the values in rtl/inc/systemh.inc: StackTop,
> StackBottom, StackLength are not behaving as thread-specific variables
> in the library, even though they are declared using ThreadVar.

Your problem is that every FPC-compiled library contains its own copy  
of the RTL. At this time you cannot create an FPC library whose RTL  
state is shared between a library and the main program. On Linux this  
will be possible after the patches attached to  
http://bugs.freepascal.org/view.php?id=12492 have been fully applied  
(they've only been applied partially for 2.4.0).

Furthermore, stack checking is broken for multi-threaded programs  
under *nix in 2.2.x. It has been fixed in 2.4.0. See  
http://bugs.freepascal.org/view.php?id=12942 for more info. And keep  
in mind that it's only an approximation, and can only be used to get a  
rough estimate of the required stack space (as explained in the  
comments to that bug).


Jonas

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.




More information about the fpc-pascal mailing list