Chin2
Chin2

Reputation: 53

dlopen fails to load shared library in android NDK application

I am trying to load a shared library in my android application using ndk, however dlOpen is failing with following error:


----- Failed to open file -----
dlopen failed: library "/vendor/lib64/egl/libEGL_adreno.so" needed or dlopened by "/data/app/~~VinTTwXtrVynTeLYP6ZLOA==/io.csrohit.ndkgl-eBpYXT0F8mUGRkEbXctU_Q==/base.apk!/lib/arm64-v8a/libndkgl.so" is not accessible for the namespace "clns-4"

below is the code snippet used to load the library:

    void * handle = dlopen("/vendor/lib64/egl/libEGL_adreno.so", RTLD_LAZY);
    if (!handle) {
        fprintf(gpFile, "----- Failed to open file -----\n");
        fprintf(gpFile, "%s\n", dlerror());
    }
    else
    {
        fprintf(gpFile, "----- file opened properly -----\n");
    }

What am I doing wrong here?

I am expecting to successfully load the shared lib and then read thr function pointers from it.

Upvotes: 0

Views: 279

Answers (1)

ed__
ed__

Reputation: 144

The library must be listed as public and you have to add it to your manifest.

Upvotes: 0

Related Questions