如何在 Android 项目中使用 ARM 汇编代码? [英] How to use ARM Assembly code in an Android project?
问题描述
我对汇编和 ARM 的经验不是特别丰富,但我能够在其中编写一些例程,我想看看它们如何在配备 ARM 的 Android 设备 (Nexus S) 上运行.将汇编代码文件包含到 Android 项目中的过程是什么?我只能从本机代码调用它,也可以从 Java 调用它吗?
I'm not particularly experienced with Assembly and ARM, but I was able to write a few routines in it and I'd like to see how they run on an ARM-equipped Android device (Nexus S). What is the procedure for including an Assembly code file into an Android project? Can I only call it from native code, or from Java also?
推荐答案
您可以使用 Java Native Interface 和 Android NDK 从 Android 调用程序集.
You can call assembly from Android using the Java Native Interface and the Android NDK.
Cedric 提到使用 asm 关键字,而我更喜欢包含汇编源代码.我已经在我的网站上发布了一个教程来做到这一点:http://www.eggwall.com/2011/09/android-arm-程序集调用程序集.html
Cedric mentions using the asm keyword, while I prefer to include assembly source code. I have posted a tutorial to do this at my site: http://www.eggwall.com/2011/09/android-arm-assembly-calling-assembly.html
您可以下载我的示例的源代码并查看它是如何工作的.一旦您看到一个正常运行的示例,就可以轻松地根据需要对其进行修改.
You can download the source code for my example and see how it works. Once you see a functioning example, it is easy to modify it to your needs.
这篇关于如何在 Android 项目中使用 ARM 汇编代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!