| 47 | |
| 48 | // Called when library is loaded by the first class which uses it. |
| 49 | extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* jvm, void* reserved) // NOLINT naming |
| 50 | { |
| 51 | debugging::ScopedTrace trace("client::JNI_OnLoad"); |
| 52 | gJvm = jvm; |
| 53 | djinni::jniInit(jvm); |
| 54 | |
| 55 | [[maybe_unused]] auto result = pthread_key_create(&gJniPtr, &threadDestructor); |
| 56 | SC_ASSERT(!result); |
| 57 | |
| 58 | JNIEnv* jni = nullptr; |
| 59 | if (jvm->GetEnv(reinterpret_cast<void**>(&jni), JNI_VERSION_1_6) != JNI_OK) |
| 60 | return -1; |
| 61 | |
| 62 | jni::runOnLoadInitializers(jni); |
| 63 | |
| 64 | return JNI_VERSION_1_6; |
| 65 | } |
| 66 | |
| 67 | // (Potentially) called when library is about to be unloaded. |
| 68 | extern "C" JNIEXPORT void JNICALL JNI_OnUnload(JavaVM* jvm, void* reserved) // NOLINT naming |
nothing calls this directly
no test coverage detected