Compiling a library in C for Android

北慕城南 提交于 2020-01-05 04:34:06

问题


I have installed the SDK,NDK,JDK and Cygwin. I want to know if I will need to edit the code of libraries to make them compile for Android(armv7).

I basically need to port a variety of C applications for Android, but they all depend on 3rd party libraries such as PCRE,OpenSSL and so forth. My experience has shown me that PCRE compiles without an error for Windows, but we are talking about Android here(running Linux kernel).

And would I need to write a C wrapper for EVERY function in the library to meet the JNI calling conventions?


回答1:


The Android NDK will compile standard C syntax, but Android does not have the same C stdlib library as desktops; instead it has its own alternative called Bionic. Sometimes when you compile large projects, you run into stdlib function calls that bionic doesn't support and you have to put a small workaround.

Sometimes popular libraries have existing JNI wrappers, otherwise you have to make a JNI call for the functions your applications call.



来源:https://stackoverflow.com/questions/11602366/compiling-a-library-in-c-for-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!