This content has been marked as final. Show 1 reply
Since I can't implement this function as a java method directly I have to call it using JNI.JNI is intended as an abstraction layer between Java and required functionality in another language (normally C/C++).
Thus you use it like this.
1. Write and debug your C/C++ code.
2. Write your java code.
3. Add JNI method to connect 1 and 2.
From the above you would NEVER attempt to call a method directly because it breaks the abstraction model.
Can anybody help me with what to do in this case?Presumably you want to pass a pointer.
1. In JNI method 1: cast pointer to a java long an return it.
2. In java code store the long.
3. Call JNI method 2 passing the long value.
4. In JNI method 2: cast the long to a pointer.
Additionally you probably need to dynamically allocate the pointer, thus you MUST determine how you are going to clean it up at some point.