簡體   English   中英

如何在Android中集成C編寫的庫? [等候接聽]

[英]How to integrate C written library in Android? [on hold]

I need to use a C written file from Java or Kotlin, i do not need to write my entire application in C, just call a funtion like the following one from Java source code

float add(float x,float y){
   float sum;
   sum=x+y;
   return sum;}

您的選擇包括:

Java 原生接口參見: https://en.wikipedia.org/wiki/Java_Native_Interface

JNI enables programmers to write native methods to handle situations when an application cannot be written entirely in the Java programming language, eg when the standard Java class library does not support the platform-specific features or program library Java Native Access

參見: https://en.wikipedia.org/wiki/Java_Native_Access

Java Native Access 是一個社區開發的庫,它使 >Java 程序無需使用 >Java 本機接口即可輕松訪問本機共享庫。 JNR-FFI

見: https://github.com/jnr/jnr-ffi

jnr-ffi 是一個 java 庫,用於在不手動編寫 JNI 代碼或使用 SWIG 等工具的情況下加載本機庫。

我建議你看看JNI: Getting Started

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM