Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / October 2005

Tip: Looking for answers? Try searching our database.

Overloading JNI methods

Thread view: 
Christian Meier - 21 Oct 2005 16:28 GMT
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.



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.