[fpc-devel] Threading support and C library under Linux/Unix

Marco van de Voort marcov at stack.nl
Tue Jun 22 14:24:37 CEST 2010


In our previous episode, Henry Vermaak said:
> > If not, then I gather the C library (libc, glibc or whatever is used these
> > days) implemented threading in C code using the POSIX spec as the guide. So
> > couldn't one implement the POSIX spec (thinking of threading support only)
> > in pure Object Pascal?

No, not straight away. That is technically impossible without integrating a
full C compiler, since POSIX requires to be able to read and interpret
system headers (e.g.  /usr/include/linux and asm on Linux systems, and
worse, afaik they have non standard constructs even)

But this is not the biggest problem.
 
> Yes, but that would probably be a very daunting task.

The problem is not the programming (since a dedicated person could probably
start with a translated glibc in a good month), but the continuous
maintenance (for every distribution separately, since they could use
different kernels, options etc) , and interoperability with C code would be
killing.

This is all more trouble than interface glibc, even longterm. FPC already
supports this (FPC_USE_LIBC) but it is not maintained/used much for
Linux/FreeBSD. Because Darwin and Solaris use it, it is not totally outdated
though.

> > Does the Qt framework also rely on the GNU C library, or do they have there
> > own threading implementation?
> 
> Qt is a c++ framework, so they rely on libc anyway.  I can't see a 
> reason why they would implement their own threading.

Unix is simply not very non C (non gcc) friendly, and worse, the
distributions (and FreeBSD too) hardly do anything to mitigate this
fundamental design problem.



More information about the fpc-devel mailing list