The first line (second paste of the code) declares a pointer to the function (I assume you know that).
Now dlsym(3) is the call that void * returns.
Thus, the second line can also be read as:
*((void **) (&fptr)) = dlsym(handle, "function");
Otherwise, it is said: instead of distinguishing the result of the function as int (*)(int) and influencing the given result on fptr; it casts a pointer to fptr (or it gives the address fptr: pointer to a pointer) as void** . He then casts that pointer, effectively giving fptr (the same as the original, but without the int (*)(int) ), which then gets the result of calling dlsym . This is just a way to βtrickβ the compiler into not triggering warnings / errors about type mismatches. Also note that even if the syntax you choose is a matter of taste, you must fully understand before using it in any program that you have released.
I hope this helps;)
source share