Porting a C/C++ program into Android
I am attempting to put my C++ program onto an Android phone but have run into several problems with the library linking. It seems most of the useful information I find on this topic through google is outdated (motz) or simply does not account for the complexity of my program. I have been able to run simple C programs but fail when attempting to use libraries outside of Android's Bionic/libc.
So my questions are:
- Is it possible to port pre-existing *.so libraries onto Android? If so, how could I do this without seg faulting?
- Should I be using the CodeSourcery compiler (arm-none-linux-gnueabi-*)?
- How 开发者_JAVA百科can I work around the lack of a seperate pthread library?
Please help me out! Thanks.
-Scott
You can't use pre-existing *.so files because they need to be compiled for Android. In order to create an *.so for Android you need to use their NDK, which is already set up to build the correct format so you don't need to worry about arm-none-linux-gnueabi or anything. If you want to use a library that isn't available on Android you'll need to build it yourself using the NDK. I had to do this with the STL.
Please refer to the following :
Can i use the native libraries (installed in android stack) in my NDK application?
This should answer you some queries...
精彩评论