如何从java调用汇编语言代码编写的函数?
嗨,我想将汇编语言代码与java结合起来。大家给我一些想法和示例程序,比如hello world,因为汇编语言对我来说是新的。
hi i would like to incorporate assembly language code with java.. guys give me some idea and example programs like hello world because assembly language is new to me..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
“正确”的解决方案是 JNI 或 JNA。
但这取决于您的代码。例如,如果您希望调用编译为本机代码的命令行实用程序(并且使用哪种语言来编码该实用程序并不重要)通过调用命令行来调用它(使用
Runtime.exec() 或 ProcessBuilder
如果它是一个库,请使用 JNI/JNA。金特罗普等The "right" solution is JNI or JNA.
But then it depends on your code. If for example you wish to call command line utility compiled to native code (and it does not matter which language was used for coding of this utility) call it by invocation of command line (use either
Runtime.exec()
orProcessBuilder
. If it is a library use JNI/JNA. If this is not just a library but for instance MS COM component (ActiveX) use one of available java interoperability projects like Jawin, Jintegra, Jinterop etc.