queen3
queen3

Reputation: 15521

dladdr does not return full path in dli_fname

I use dladdr to get full path to the library:

Dl_info dl_info;
int ret = dladdr((void*)&func, &dl_info);
if (ret)
            // use dl_info.dli_fname;

It works fine. However, if I rename the folder with the build (and then run again), dli_fname does not contain full path, only file name of the library. Why is that?

There're other steps except renaming build folder (misc. cmake changes, mostly related to install functionality), but nevertheless the issue appears only after renaming (i.e. the application is run not from the build folder).

Upvotes: 0

Views: 2206

Answers (1)

coder
coder

Reputation: 203

dl_info.dli_fname not always contain full path in android ( see here)

This is a workaround in this case: see my answer

Upvotes: 0

Related Questions