Monday, August 22, 2011

Java call C function

[1] One Pdf document 'Java call C via JNI'
[2] Sun link of using JNI
[3] Java call C on power PC
[4] Sun book of JNI
[5] JNI and JNA in Wiki
[6] JNA intro on wiki
[7] where to download jna.jar

The JNA library uses a small native library called foreign function interface library (libffi) to dynamically invoke native code. [6]

Java Native Interface[5]

The Java Native Interface has a high overhead associated with it, making it costly to cross the boundary between code running on the JVM and native code.[69][70] Java Native Access (JNA) provides Java programs easy access to native shared libraries (DLLs on Windows) without writing anything but Java code—no JNI or native code is required. This functionality is comparable to Windows' Platform/Invoke and Python's ctypes. Access is dynamic at runtime without code generation. But it comes with a cost and JNA is usually slower than JNI.[71]

No comments: