Sunday, September 25, 2011

Implementing xlocale APIs

The FreeBSD Foundation is pleased to announce that David Chisnall has been awarded a grant to implement xlocale APIs to enable porting libc++.

The C standard library (libc) is one of the most important parts of a UNIX system as most programs interact with the kernel through interfaces written in C. Porting code between platforms with similar libc implementations is trivial and if something is supported by libc, higher-level languages can use it without being reimplemented.

Over time, the C language has slowly evolved to modern multicore systems, but there are still some places that are problematic. One of these is localization as C began originally had no localization support. FreeBSD libc and Darwin libc (used by Mac OS X) are similar, making it much easier to port code from OS X to FreeBSD than from OS X to Linux. The libc used by OS X supports a set of extended locale functions (xlocale) that allow locale to be set on a per-thread basis.

Additionally, libc++, from the LLVM project, was originally developed on Darwin, so it uses xlocale for most of the C++ locale support. The lack of this support is the primary obstacle to porting it to FreeBSD.

Once xlocale is supported in FreeBSD libc, we can port libc++ to FreeBSD, giving us an MIT-licensed C++11 standard library implementation. This, in conjunction with Clang and libcxxrt, means that the entire C++ stack in FreeBSD will be free of any GNU code. This leaves the linker as the only significant obstacle to a GPL-free FreeBSD 10.

The project will conclude the end of September 2011.

No comments:

Post a Comment