[fpc-pascal] usage of {$FPC_USE_LIBC}

Marco van de Voort marcov at stack.nl
Tue Jul 18 09:39:21 CEST 2006


> I read http://www.freepascal.org/wiki/index.php/OS_aware_RTL
> 
> and wonder when {$FPC_USE_LIBC} is set and how the decision is made?

For *nix the main advantage of syscalls is that the avg small
binary holds better in time, not in the least the compiler itself.
Also crosscompiling these basic binaries doesn't require the libraries of
the target. I recently cleanup a system that was constantly upgraded, and
found '98-'99 FPC binaries that were still working on Sarge.

For large binaries using lots of libraries (like lazarus) it is less
useful, since they link to libc anyway. 

Note that using libc has some advantages too, I list some in
http://www.stack.nl/~marcov/unixrtl.pdf which was the original design doc
for the Unix reform.  The most commonly expected one, a size advantage is
not true however. FPC syscall binaries are smaller than their corresponding
libc linked one. This probably because dynlinking forces some rather large
tables into the binary, and the actual syscall using code is very small.

The decision to base Darwin on libc was Jonas'. It seems to work, but there
was never a competing syscall solution (that might also have worked).



More information about the fpc-pascal mailing list