官术网_书友最值得收藏!

Introduction

This chapter explains how to port existing popular C/C++ libraries to Android using Android NDK. These libraries are widely used to implement feature-rich applications with graphics, sounds, and physical simulations entirely in C++. There is not much fun in simply compiling libraries. So, the parts related to FreeImage, FreeType, and Box2D provide minimal samples to demonstrate the functionality of each library. Audio and networking libraries are discussed in greater detail in the subsequent chapters. We will show you how to compile libraries and, of course, give some short samples and hints on how to start using them.

Typical caveats for porting libraries across different processors and operating systems are memory access (structure alignment/padding), byte-order (endianness), calling conventions, and floating-point issues. All the libraries described below address these issues quite well, and even if some of them do not officially support Android NDK, fixing this is just a matter of a few compiler switches.

To build any of the mentioned libraries, we need to create makefile for the Windows version and a pair of the Android.mk and the Application.mk files for Android NDK. The source files of the library are compiled to object files. A collection of object files is combined into an archive, which is also called a static library. Later, this static library can be passed as an input to the linker. We start with the Windows version because the Android.mk and Application.mk files are built on top of standard makefiles.

主站蜘蛛池模板: 高雄县| 南涧| 吉林市| 清丰县| 健康| 五峰| 屏边| 白城市| 聊城市| 金堂县| 鲜城| 安康市| 马山县| 雷波县| 眉山市| 陵水| 张家口市| 宿州市| 常山县| 曲阳县| 鄂托克旗| 文水县| 河曲县| 靖安县| 瓮安县| 甘孜县| 措美县| 城口县| 东港市| 玛纳斯县| 霍林郭勒市| 鹿泉市| 上饶市| 文山县| 嵊泗县| 惠州市| 河间市| 潼南县| 牡丹江市| 朝阳市| 化州市|