本文介绍了编译图书馆用C为Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了SDK,NDK,JDK和Cygwin。我想知道我是否会需要编辑库的code,使它们编译为Android(ARMv7的)。

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).

基本上,我需要端口的各种C应用程序为Android,但它们都依赖于第三方库,如PCRE,OpenSSL和等等。我的经验告诉我说PCRE编译没有为Windows错误,但我们在这里谈论的Andr​​oid(运行Linux内核)。

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).

和我需要写每一个功能的C包装库,以满足JNI调用约定?

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

推荐答案

而Android NDK将编译标准C语法,但Android不具备相同的C STDLIB库桌面;相反,它有它称为仿生自己的选择。有时,当你编译大的项目,你碰到STDLIB函数调用仿生不支持,你必须把小的解决方法。

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.

有时候流行的库具有现有JNI包装,否则你必须做出JNI调用您的应用程序调用的函数。

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

这篇关于编译图书馆用C为Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 01:00