Symbol addr to shared object handle?

(I know this isn’t a Fedora-specific question, but it’d be appreciated if anyone can shed some light.)

void *h_so=dlopen(“liba.so”, RTLD_GLOBAL|RTLD_NOW);
void *p_symbol=dlsym(so, “symbol”);

  1. I want to recover the value of h_so from p_symbol, is there a portable (POSIX-compliant if possible) way?
  2. If I should be using dladdr(), is Dl_info::dli_fbase suitable for subsequent dlsym() calls?
  3. Or should I be dlopen()ing the same file path again, hoping it will return the exact same value (representing the loaded instance of that so)?

Hi @candy76041820 : this doesn’t quite seem like a Fedora specific issue so I’m not sure if you’ll get the best help here. Perhaps a general programming forum would be better for this one.