简体   繁体   中英

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?

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.

Thanks, Emilio.

You can use Java Native Access, JNA , to do exactly what you want.

Note that the usual wrapper library wouldn't be written in C++, but in C.

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. Use SWIG instead. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM