Get the pointer of a Java ByteBuffer though JNI

前端 未结 2 1750
独厮守ぢ
独厮守ぢ 2020-12-31 19:36

How can I get a pointer to the inner array of a Java ByteBuffer?

JNIEXPORT void JNICALL test(JNIEnv *env, jobject thiso) {
    jclass cls = env->FindClass         


        
2条回答
  •  春和景丽
    2020-12-31 20:00

    If you're trying to return the address of the first element within m_buffer, then you can just do:

    return m_buffer;

    ..or:

    return &m_buffer[0]

提交回复
热议问题