[英]Java Native Invocation without C++ wrapper lib
is there a way to invoke functions in native libraries (Windows .dll's, Linux .so's), withouth having to write a C++ wrapper dealing with JEnv and "this" pointers? 有没有一种方法可以调用本机库(Windows .dll,Linux .so)中的函数,而不必编写处理JEnv和“ this”指针的C ++包装器?
I'm missing C#-alike functionality in this regard, where one can link with native functions easily without writing bridge libraries, leaving up to the compiler marshaling details. 在这方面,我缺少与C#相似的功能,该功能可以轻松地与本机函数链接,而无需编写桥库,而让编译器编组细节。
Thanks, Emilio. 谢谢,埃米利奥。
I hated having to write JNI code and looked at JNA but it didn't seemed to be that widely used and might present a potential performance problem. 我讨厌不得不编写JNI代码并查看JNA,但它似乎没有得到广泛使用,并且可能会带来潜在的性能问题。 Use SWIG instead.
请改用SWIG 。 Once you are up and running it doesn't take that long to script it and get it generating your JNI interface code for you.
一旦启动并运行,就不需要花很长时间来编写脚本并让它为您生成JNI接口代码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.