Chapter 9. Porting Existing Libraries to Android
There are two main reasons why one would be interested in the Android NDK: first, for performance, and, second, for portability. In the previous chapters, we saw how to access the main native Android APIs from native code for efficiency purposes. In this chapter, we will bring the whole C/C++ ecosystem to Android, well, at least discovering the path, as decades of C/C++ development would be difficult to fit the limited memory of mobile devices anyway! Indeed, C and C++ are still some of the most widely used programming languages nowadays.
In previous NDK releases, portability was limited due to the partial support of C++, especially Exceptions and Run-Time Type Information (RTTI, a basic C++ reflection mechanism to get data types at runtime such as
instanceof
in Java). Any library requiring them could not be ported without modifying their code or installing a custom NDK (the Crystax NDK, rebuilt by the community from official...