NDK Programmer's Guide
|
This document contains a list of known issues in existing Android system images that NDK developers should be aware of.
The following issues correspond to the official Android 1.5 system images:
The Android C++ system runtime only provides very little support for C++ features (i.e. RTTI, exceptions and Standard Library). However, the NDK provides more advanced runtimes that can be linked into your application, if you need them.
See docs/CPLUSPLUS-SUPPORT.html for more details.
The C library doesn't try to implement every feature under the sun. Most notably, pthread cancellation is not supported. A detailed overview of the C library and its design is available in docs/system/libc/OVERVIEW.html
Unix System V Inter-Process Communication APIs (e.g. semget()) are intentionally not available from the C library, to avoid denial-of-service issues. See docs/system/libc/SYSV-IPC.html for details.
The Android 1.5 C library function getservbyname() returns the port number corresponding to a given network service in incorrect order. The function stores its result in a 'struct servent' structure, and the port number in its 's_port' field.
The standard mandates that this value is stored in network order (and thus should be converted to host order through ntohs()). However, the 1.5 implementation is buggy and returns the number.
This bug is fixed in later releases of the platform, and applications should not depend on the wrong behaviour in the future. Avoid using this function if possible; if this is not possible, try to use a small wrapper like the following one:
static struct servent* my_getservbyname(const char* name, const char* proto) { static int has_bug = -1; struct servent* ret; if (has_bug < 0) { ret = getservbyname("http",NULL); has_bug = (ret == NULL || ret->s_port == 80); } ret = getservbyname(name, proto); if (has_bug) ret->s_port = htons(ret->s_port); }
(the returned struct servent is thread-local and can be modified by the caller. It will be over-written on the next call to the function though).
The Android dynamic linker in 1.5 has many important limitations: