This content has been marked as final. Show 4 replies
1. What's 'v' for?
2. What's the JNI for? You can return constant double values in Java, you don't need JNI or C or MIPS compilers for that.
v is not connected with this question.
My point is the JNI return is not what I expect, using constant double just make question simple. :)
'v' is a parameter to the method so of course it is relevant. I'm wondering whether you have changed the signature of the Java method without regenerating the header file and changing the signature in the C file accordingly.
860938 wrote:Without having actually tried the code my first guess would be that this is not your problem.
JNIEXPORT jdouble JNICALL Java_Test_getDouble(JNIEnv *env, jclass unused, jlong v)
double d = -2.71000;
When Test.getDouble() is called in java, NaN is returned.
Can someone tell me what is going on here and how can I fixed it?
I suspect that if I did try the code it wouldn't return the result you are seeing. Thus there would be two possibilities.
1. You are not running the code that you are posting here.
2. Something is wrong with the way you are compiling it.
If I remember I will try the code you posted.