I have the following JNI code:
JNIEXPORT jint JNICALL Java_demo_Test_callCritical
(JNIEnv *env, jclass jobj_clazz)
{
printf("I'm not critical\n");
return 1;
}
JNIEXPORT jint JNICALL JavaCritical_demo_Test_callCritical ()
{
printf ("I'm critical\n");
return 1;
}
And Kotlin code:
package demo
class Test {
companion object {
@JvmStatic
external fun callCritical(): Int
}
}
If I run the program, it processes the Java method, not JavaCritical. I met all the conditions for running JavaCritical.
There is a similar question: How to get JavaCritical to really work on JNI , but I build the native part and run it on MacOS.
UPD: I built under jvmTarget 1.8, the version of kotlin 1.3.61, and ran on jvm 1.8.0_222 and 11.0.2