Skip to content Skip to sidebar Skip to footer

Jni Native Function Overload Signature

I am trying to use function overload when declaring JNI native functions. The Java method is : public native static void methodaaa(String type, int errorCode); public native static

Solution 1:

Don't attempt to figure out JNI method signatures yourself. Use the output of javah. It is never wrong.

Solution 2:

https://edux.pjwstk.edu.pl/mat/268/lec/lect10/lecture10.html

maybe this will help you

/* DO NOT EDIT THIS FILE - it is machine generated */#include<jni.h>/* Header for class getter_number_GetNumber */#ifndef _Included_getter_number_GetNumber#define _Included_getter_number_GetNumber#ifdef __cplusplusextern"C" {
    #endif/*
     * Class:     getter_number_GetNumber
     * Method:    getNumber
     * Signature: ()I
     */JNIEXPORT jint JNICALL Java_getter_number_GetNumber_getNumber__(JNIEnv *, jobject);

    /*
     * Class:     getter_number_GetNumber
     * Method:    getNumber
     * Signature: (J)J
     */JNIEXPORT jlong JNICALL Java_getter_number_GetNumber_getNumber__J(JNIEnv *, jobject, jlong);

    /*
     * Class:     getter_number_GetNumber
     * Method:    getNumber
     * Signature: (FF)F
     */JNIEXPORT jfloat JNICALL Java_getter_number_GetNumber_getNumber__FF(JNIEnv *, jobject, jfloat, jfloat);

    #ifdef __cplusplus
    }
    #endif#endif

Field descriptors of the primitive types are presented in the table.

Java type   Field descriptor
boolean Z
byte    B
char    C
short   S
int     I
long    J
float   F
double  D

Solution 3:

Additionally, JNI function names are C, not C++. They can not be overloaded.

Solution 4:

__J added in function,it works for me.

Post a Comment for "Jni Native Function Overload Signature"