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