I have Java application which sends pointer to function (callback) to some native dll kernel.
I use xfunction library for manipulations with the native code. I have to handle int* pointer as an array of integers within callback body. In fact, I have com.excelsior.xFunction.Pointer object. I need to make some tricks for transforming com.excelsior.xFunction.Pointer => int [] array.
Can JNA library help (using com.sun.jna.Pointer, IntByReference)?
For example, com.excelsior.xFunction.Pointer => com.sun.jna.Pointer => int [] array.
I don’t want to rewrite code in order to eliminate calls to xfunction.
XFunction does not seem to give the ability to fetch back the native pointer. Since it’s not opensourced and their falgship product is a Java obfuscator I think you’re stuck and won’t be able to do com.excelsior.xFunction.Pointer => com.sun.jna.Pointer.
So, as they say ( http://www.excelsior-usa.com/xfunction.html ) :
I think you’d better to recode this part of your app in full JNA to do what you want … or stick with XFunction
Anyway, if you manage to find a way to fetch back XFunction’s native pointer just cast it to a Java
longand pass it to JNA’snew com.sun.jna.Pointer(long)and then just doa
com.sun.jna.Pointer.getIntArr(offset,arrayLength)to fetch back the array in pure Java