Pergunta

during reserch of some library I found this kind of code

Dl_info info = {
   NULL,
   NULL,
   NULL,
   NULL
};

if (!dladdr((void*) dirSep, &info)) {
   return libPath.c_str();
}

where dirSep is static const char* member in class where this code is present (in come member function), so my question is: is there any place documented that dladdr function able get an info form static const member field ?

Foi útil?

Solução

No, and dladdr can't promise or guarantee that. It can only look at the symbol table in the module. If the symbol table contains the symbol, then it can give it to you. If not, not. What symbols are in the symbol table depends on how the module is compiled, how it is linked, and how and whether it is stripped.

Generally speaking, if code could link to it, then dladdr should find it.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top