java驱动dll文件
由于项目需要,要驱动dll文件从平台中取值,所有做了一个java类读取dll文件,执行函数
?
?
?类用到了JNative插件来操作dll文件的
JNative中有个类Pointer实现了类似于c语言中的指针的作用!当是以为实现指针是驱动了自己jar包中dll文件实现的,但是我把C:\Windows\System32下的JNativeCpp.dll和它自身jar包中的JNativeCpp.dll都删了,但是它依然可以工作,于是查看源代码,结果更迷惑了!!!
Pointer是用setStringAt方法往里面赋值的,而setStringAt方法调用了JNative.setMemory()方法,
JNative.setMemory()方法调用了自身的nSetMemory()方法,但是?nSetMemory方法是这样定义的:
?
private static native void nSetMemory(int pointer, byte[] buff, int offset, int len) throws NativeException;??
到这里就结束了.........
到底也不知道它是怎么实现Pointer的???