KotlinIsland
KotlinIsland

Reputation: 867

How to get unsigned long long from C++ to Kotlin through JNI?

I'd like to read an unsigned long long from my Kotlin code. The value comes from C++ code through JNI.

Here is the C++ code :

unsigned long long getMaxValue() {
    return -1;
}

Here is the JNI code :

extern "C"
JNIEXPORT jlong JNICALL
Java_com_tb_of_1ir_MainActivity_getMaxValue(JNIEnv *env, jobject thiz) {
    static auto a = MyCppSingleton::get();
    return a->getMaxValue();
}

And here is the Kotlin code :

Toast.makeText(this, "getMaxValue : \"${getMaxValue()}\"", Toast.LENGTH_LONG).show()
private external fun getMaxValue(): Long

I also tried with BigInteger but with no result...

Thanks !

Upvotes: 1

Views: 457

Answers (1)

KotlinIsland
KotlinIsland

Reputation: 867

It is not possible in a simple way. Maybe by decomposition.

Upvotes: 1

Related Questions