JNA 的出现,极大的简化了原有的 JNI 技术。下面是JNA github地址:https://github.com/java-native-access/jna1. 简单的一个例子:/** Simple example of JNA interface mapping and ...
JNA 的出现,极大的简化了原有的 JNI 技术。下面是JNA github地址:https://github.com/java-native-access/jna
1. 简单的一个例子:
/** Simple example of JNA interface mapping and usage. */public class HelloWorld { public interface CLibrary extends Library { CLibrary INSTANCE = (CLibrary)Native.loadLibrary((Platform.isWindows() ? "msvcrt" : "c"), CLibrary.class); void printf(String format, Object... args); // void printf(const char *format, [argument]); } public static void main(String[] args) { CLibrary.INSTANCE.printf("Hello, World\n"); for (int i=0; i < args.length; i++) { CLibrary.INSTANCE.printf("Argument %d: %s\n", i, args[i]); } } }
原标题:JNA 如何 加载多个 存在依赖的 DLL 库
关键词:
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们:
admin#shaoqun.com
(#换成@)。