Reputation: 405
Is it possible to call a JNI C function inside another JNI C function? (directly or indirectly), or, a JNI function inside a normal C function?
For example:
int inverse_transform(double real[], double imag[], size_t n) {
return Java_com_example_ffttest_FFTActivity_transform(imag, real, n);
}
and inverse_transform()
is later called inside another method.
JNIEXPORT jint JNICALL Java_com_example_ffttest_FFTActivity_convolve(...)
{
....
inverse_transform();
}
Does this work? I tried but it gives me errors about parameters and I don't know how to use *env and obj.
Upvotes: 1
Views: 1182
Reputation: 61408
Certainly it's possible. Those are just functions with funny names as far as C is concerned.
One word of caution though - if the JNI function uses its JNIEnv
parameter, you need to pass a valid one from a non-JNI function.
Upvotes: 3
Reputation: 1432
At the end JNI methods are normal c++ methods so offcourse you can do it .
Upvotes: 0