0

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).

queen3
  • 15,333
  • 8
  • 64
  • 119
  • you seem to have a partial answer in the question. The other half of the question is *what changes when you move the directories*. i.e. do you change the `dlopen`, etc at that point? – Anya Shenanigans Mar 19 '13 at 16:34
  • Nothing changes, I just rename directories in file manager. – queen3 Mar 19 '13 at 17:43

1 Answers1

0

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

This is a workaround in this case: see my answer

coder
  • 163
  • 2
  • 3
  • 12