Question

for example android is using bionic rather than glibc, but how to figure out it is really using bionic http://en.wikipedia.org/wiki/Bionic_(software), not glibc?

can i find this information in /proc filesystem, or is there any command which can tell bionic is used on current system?

by the way, is that possible to have more than one c lib on embeded systems?

Was it helpful?

Solution

If you have code that needs to behave differently depending on whether it's linked with Bionic or Glibc, this can and must be determined at compile time. Bionic and Glibc aren't binary compatible anyway, so you need to commit to one set of headers at compile time.

#if __BIONIC__
/* Bionic-specific code */    
#elif __GLIBC__
/* Glibc-specific code */
#else
#error "This C library is not supported"
#endif

You won't find any information in /proc because /proc contains information about the kernel, not about the C library.

In theory, it is possible to put as many C libraries on a system as you like. However this would be very unusual on an embedded system since these generally try to keep the code size down. The only system where I would expect multiple C libraries is on an embedded developper's machine, if that developper happens not to be cross-compiling (which is rare in the first place). Furthermore, Bionic is only used on Android, and only Bionic is used on Android, so all Android systems have Bionic and other systems don't have Bionic. Non-Android Linux systems have some other library, either Glibc or (on embedded systems) some other libc such as uClibc or Dietlibc.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top