[fpc-devel] libc translations

Michael Van Canneyt michael at freepascal.org
Sun Aug 10 11:30:04 CEST 2008

On Sun, 10 Aug 2008, Boian Mitov wrote:

>    Hi Daniel,
> Thank you!
> As I mentioned I am very new, and still don't know the exact rules of the
> purpose of specific units. I am not sure if the timers are available on other
> systems than Linux yet. I am sure there is some form of equivalent. I actually
> don't have any Kylix code. I am porting Windows code, actually making it cross
> platform as we support Delphi 5-2007, and plan to support Lazarus for Windows
> and Linux for now, and hopefully for other platforms in the future. Porting
> huge code from Windows is slow and error prone process, so I am doing it in
> stages. For now I have made everything to recompile under Lazarus in Linux,
> and now I am filling the items I had to cut from the code during the
> conversion. In Windows I use the Media Timers, and the only equivalent thing I
> have found in Linux is the High Resolution timers. I have been studding the
> FPC and Lazarus code, and I discovered the libc, and it seemed as the logical
> place such timers to be implemented. If they belong to a different location,
> this is fine. I can also keep them in my code, but I thought other people can
> benefit from the translation.

I think it is necessary to explain certain things a bit more:

FPC tries to be independent of the C library as much as possible. 

We do provide an interface to the Unix system which is very much 
like the C library (that is, adheres roughly to certain Posix 
standards), so you will find most LibC functionality in the 
BaseUnix, Unix, UnixTypes units. These units are cross platform
(for unix like systems), and, where possible, interface to the 
unix kernel. For some platforms they simply fall back to the C 
library of the system.

On the other hand, Kylix based itself on GNU Libc entirely. 
For compatibility reasons, we have created a similar unit as 
Kylix had. This unit can be used, but only on i386 and on
systems that use GNU libc (Linux, in casu), because the 
record and type definitions it contains are i386 and GNU Libc specific.

You have therefor 2 options:
- Continue with using Libc, and provide patches that keep it  up to date.

- Implement the functionality that you need in a Posix like way, and make
  sure it works accros processor architectures and operating systems.

Naturally, we prefer the latter - as explained by Daniel - but if you 
want to do the former (which is most likely less work): no problems, 
we accept patches.


More information about the fpc-devel mailing list