Hi
I hope this post is not off-topic here but I couldn't find a more
appropriate newsgroup.
I want to overload methods in the JNI and have a problem with the method
name which has to be extended with two underscores and the encoded argument
descriptors. Everything works fine when I use parameter like byte, short or
string. With all these parameters my method would be
"Java_jni_MyTestClass_overloadedFunction__BSLjava_lang_String_2(JNIEnv* env,
jobject jObj, jbyte bInByte, jshort sInShort, jstring lsInString)". Now the
problem: I can't figure out what the argument descriptor for the
parameter-type "jobject" is. I tried "Ljava_lang_Object_2" but this didn't
work. I couldn't find samples using jobject parameter in overloaded methods
on the internet and usenet. Can you tell me the argument descriptor for
"jobject"?
Greetings Chris
Gordon Beaton - 21 Oct 2005 17:17 GMT
> I want to overload methods in the JNI and have a problem with the
> method name which has to be extended with two underscores and the
[quoted text clipped - 8 lines]
> using jobject parameter in overloaded methods on the internet and
> usenet. Can you tell me the argument descriptor for "jobject"?
I'm not sure I understand exactly what you're asking, but don't see
why you can't just declare the various overloaded methods in a Java
class, compile it and run javah to see what names it generates.
Note that you don't actually need to use the names javah suggests if
you use RegisterNatives() to associate your native methods with the
class. RegisterNatives() lets you associate the method signature with
a pointer to a native function, so the actual symbol name becomes
unimportant.
/gordon

Signature
[ do not email me copies of your followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e
Roedy Green - 22 Oct 2005 01:05 GMT
>jbyte bInByte, jshort sInShort, jstring lsInString)". Now the
>problem: I can't figure out what the argument descriptor for the
>parameter-type "jobject" is.
You don't have to. Just run javah and look at the resulting *.h file.
Am I misinterpreting your question?
See http://mindprod.com/jgloss/jni.html

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.