static JavaVM *get_java_vm(const char *name, void *log_ctx)

{

    JavaVM *vm = NULL;

    jsize nb_vm = 0;



    void *handle = NULL;

    jint (*get_created_java_vms) (JavaVM ** vmBuf, jsize bufLen, jsize *nVMs) = NULL;



    handle = dlopen(name, RTLD_LOCAL);

    if (!handle) {

        return NULL;

    }



    get_created_java_vms = (jint (*)(JavaVM **, jsize, jsize *)) dlsym(handle, "JNI_GetCreatedJavaVMs");

    if (!get_created_java_vms) {

        av_log(log_ctx, AV_LOG_ERROR, "Could not find JNI_GetCreatedJavaVMs symbol in library '%s'\n", name);

        goto done;

    }



    if (get_created_java_vms(&vm, 1, &nb_vm) != JNI_OK) {

        av_log(log_ctx, AV_LOG_ERROR, "Could not get created Java virtual machines\n");

        goto done;

    }



done:

    if (handle) {

        dlclose(handle);

    }



    return vm;

}

static JavaVM *get_java_vm(const char *name, void *log_ctx)

{

    JavaVM *vm = NULL;

    jsize nb_vm = 0;



    void *handle = NULL;

    jint (*get_created_java_vms) (JavaVM ** vmBuf, jsize bufLen, jsize *nVMs) = NULL;



    handle = dlopen(name, RTLD_LOCAL);

    if (!handle) {

        return NULL;

    }



    get_created_java_vms = (jint (*)(JavaVM **, jsize, jsize *)) dlsym(handle, "JNI_GetCreatedJavaVMs");

    if (!get_created_java_vms) {

        av_log(log_ctx, AV_LOG_ERROR, "Could not find JNI_GetCreatedJavaVMs symbol in library '%s'\n", name);

        goto done;

    }



    if (get_created_java_vms(&vm, 1, &nb_vm) != JNI_OK) {

        av_log(log_ctx, AV_LOG_ERROR, "Could not get created Java virtual machines\n");

        goto done;

    }



done:

    if (handle) {

        dlclose(handle);

    }



    return vm;

}

static JavaVM *FUNC_0(const char *name, void *log_ctx)

{

    JavaVM *vm = NULL;

    jsize nb_vm = 0;



    void *VAR_0 = NULL;

    jint (*get_created_java_vms) (JavaVM ** vmBuf, jsize bufLen, jsize *nVMs) = NULL;



    VAR_0 = dlopen(name, RTLD_LOCAL);

    if (!VAR_0) {

        return NULL;

    }



    get_created_java_vms = (jint (*)(JavaVM **, jsize, jsize *)) dlsym(VAR_0, "JNI_GetCreatedJavaVMs");

    if (!get_created_java_vms) {

        av_log(log_ctx, AV_LOG_ERROR, "Could not find JNI_GetCreatedJavaVMs symbol in library '%s'\n", name);

        goto done;

    }



    if (get_created_java_vms(&vm, 1, &nb_vm) != JNI_OK) {

        av_log(log_ctx, AV_LOG_ERROR, "Could not get created Java virtual machines\n");

        goto done;

    }



done:

    if (VAR_0) {

        dlclose(VAR_0);

    }



    return vm;

}

static JavaVM *FUNC_0(const char *name, void *log_ctx)
{ JavaVM *vm = NULL; jsize nb_vm = 0; void *VAR_0 = NULL; jint (*get_created_java_vms) (JavaVM ** vmBuf, jsize bufLen, jsize *nVMs) = NULL; VAR_0 = dlopen(name, RTLD_LOCAL); if (!VAR_0) { return NULL; } get_created_java_vms = (jint (*)(JavaVM **, jsize, jsize *)) dlsym(VAR_0, "JNI_GetCreatedJavaVMs"); if (!get_created_java_vms) { av_log(log_ctx, AV_LOG_ERROR, "Could not find JNI_GetCreatedJavaVMs symbol in library '%s'\n", name); goto done; } if (get_created_java_vms(&vm, 1, &nb_vm) != JNI_OK) { av_log(log_ctx, AV_LOG_ERROR, "Could not get created Java virtual machines\n"); goto done; } done:
if (VAR_0) { dlclose(VAR_0); } return vm; }