Just want to understand the following code:
Why we use option (1) other than option (2)? I don't know what's the use of (void**) here? really confused.
Class Handle{
private:
int unique_id;
int (*m_handle)(int arg1, int arg2);
public:
bool init(){
*(void **)(&m_handle) = dlsym(dlopen(./haldle_lib.so, RTLD_NOW), "custom_func"); // (1)
//m_handle = (decltype(m_handle))dlsym(dlopen(./haldle_lib.so, RTLD_NOW), "custom_func");//(2)
}
}
add reference https://www.tldp.org/HOWTO/pdf/C++-dlopen.pdf