I’m working with JNI on a current project, and am getting a strange error from my C++ code during compilation. I get an error stating:
error: overloaded function with no contextual type information
This is coming from the “nativegetsupportedciphersuites” line in the following array, which is mapping java functions with their C++ counterparts. I’ve cut out the other array members to make it easier to read.
static JNINativeMethod sSocketImplMethods[] =
{
...
{"nativegetsupportedciphersuites", "()[Ljava/lang/String;", (void*)&Java_mypackage_SocketImpl_nativegetsupportedciphersuites},
...
};
I think it must be an error with the type declaration, but really have no clue. The type declaration was generated by the javah function, so I assume it is correct. The function signature of the above method is shown below:
JNIEXPORT jobjectArray JNICALL Java_mypackage_nativegetsupportedciphersuites(JNIEnv* env, jobject object)
Any Thoughts?
Chris
The error message indicates that you method is overloaded. The compiler can’t figure out which one of the overloads you want to take a pointer to, since it doesn’t have any parameter information.
It sounds like you didn’t intend to overload the method. Do you have a second declaration of that method anywhere? Are you using the exact same signature in both the header and the body?