void* l = dlsym(lib,"_ZN11Environment9LibLogger14log_processingEiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEjS6_z");
*(void **)&log_fcn = l;
std::cout<<"Address"<<<<l<<"LOG_FCN "<<log_fcn<<std::endl;
I am trying to print address of l and log_fcn but both are not same. Why is that, and how can I get address of dlsym assign to function pointer?
Output example:
l= 0x7efe10eabaa0 LOG_FCN 1
void (*log_fcn)(int level, std::string frmt, unsigned int line_no, std::string file_name, ...); function decleration
(void*)log_fcn? the stream seems to convert it to bool instead of pointer otherwiseboolltodecltype(log_fcn), not assign tolog_fcnthrough avoid*lvalue. The latter is an aliasing violation.