[fpc-pascal] Why is cthreads unit not included by default

Florian Klaempfl florian at freepascal.org
Thu Aug 27 13:03:19 CEST 2009


Graeme Geldenhuys schrieb:
> Michael Van Canneyt wrote:
>> Because I want a FPC program to depend only on the Linux kernel, 
>> not on the C library.
> 
> OK.
> 
> 
>> There are FPC programs from 8 years back that still work with the current 
>> kernel. Try that with a program that depends on the C library.
> 
> Sorry if this sounds dumb - it's late in the week. ;-)
> Is this an issue, even if your program doesn't use any
> procedures/functions from the dynamically linked C library. For example,
> a console application that includes the cthreads unit (which dynamically
> links to C Library), but doesn't actually use the C Library or threads.
> Would such a console application not run on an 8 year old Linux distro?

No, because using cthreads overrides internal dummy callbacks by
procedures linking against libc thus libc is linked in. Further, units
like classes or the heap manager use internally critical sections so you
really depend on libc if you link cthreads. If you don't include
cthreads these callbacks/hooks are simply empty with the side effect
that things are faster.



More information about the fpc-pascal mailing list