I have a void pointer returned by dlsym(), I want to call the function pointed by the void pointer. So I do a type conversion by casting:
void *gptr = dlsym(
This may help you. It prints "Hello".
#include void hello() { std::cout << "Hello" << std::endl; } int main() { typedef void (*fptr)(); fptr gptr = (fptr) (void *) &hello; gptr(); }
OR you can do:
fptr gptr = reinterpret_cast( (void *) &hello);
where &hello is replaced by the dlsym command.