JNI - Returning value via output parameter
843829Apr 10 2006 — edited Apr 11 2006Hi-
I have a piece of java code that looks like this:
public static String addMe(Double a, Double b, Double result) {
result = new Double(a.doubleValue() + b.doubleValue());
return "Addition worked!!";
}
As you can see I want to return the result of the function as a function parameter and have the function return variable be an info/error message.
I'm trying to call this via JNI, and I can get the return string to work.
But no matter what I try, I cannot get "result" to be returned populated.
I want to call Java FROM C.
I tried changing result to a double, Double, double[], and tried using jobject, jdouble, jdouble*, jdoubleArray, etc, on the C side.
I would love some help on this matter with some sample code.
Thanks