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 / Virtual Machine / September 2005

Tip: Looking for answers? Try searching our database.

JNI two java classes makes same native call..will it affect the signature

Thread view: 
Neena - 21 Sep 2005 07:34 GMT
Hi,

I have two java classes, say client.java and server.java. both classes
make a call to my native method getName(long).
i made the .h file of client and wrote the function getName
accordingly, ie, i gave the function name as

JNIEXPORT jintArray JNICALL Java_Client_getName
 (JNIEnv *, jobject, jlong);

but i have server.h also.ie,

JNIEXPORT jintArray JNICALL Java_Server_getName
 (JNIEnv *, jobject, jlong);

what shall i do? write the native function twice???

Regards

Neena
Chris Uppal - 21 Sep 2005 08:14 GMT
> JNIEXPORT jintArray JNICALL Java_Client_getName
>   (JNIEnv *, jobject, jlong);
[quoted text clipped - 5 lines]
>
> what shall i do? write the native function twice???

Write two short native functions that both invoke the same real code.

Alternatively, move method into a separate class where can be invoked from both
Server and Client without duplication.

   -- chris


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



©2008 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.