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



Neena wrote:

> 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???

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



.



Relevant Pages

  • Re: trouble passing float array from C to java method
    ... The application itself is in C, and uses JNI to invoke Java ... doing so will create a JNIEnv which is valid in, and only in, that OS thread. ... Any jobjects (local references) which are created via that JNIEnv are also ... jobject created during that call will be released when the ...
    (comp.lang.java.programmer)
  • Challenge: Marshalling a jobjectArray from JNI
    ... I have got a DLL file which has been badly affected to be accessed from a ... jobjectArray (it is an array of java strings). ... (JNIEnv *, jobject); ...
    (microsoft.public.dotnet.framework.interop)