2010年1月6日 星期三

Google Android Native libc Bionic library

Google developed a custom library for the C compiler (libc) called Bionic. This was necessary for three main reasons:

  • License: they wanted to keep GPL out of user-space. Bionic code uses the BSD license.
  • Size: the library has to be loaded in each process, so it needs to be small. Bionic is about 200K, or half the size of glibc (the GNU version of libc).
  • Speed: limited CPU power means it needs to be fast. Bionic has a small size and fast code paths, including a very fast and small custom pthread implementation.

Bionic has built-in support for important Android-specific services such as system properties and logging. It doesn't support certain POSIX features, like C++ exceptions and wide chars, which were not needed on Android. Thus it's not quite compatible with the gnu libc. All native code must be compiled against bionic, not glibc.

沒有留言:

張貼留言