A reason for a function pointer like void (*f)(void) is that C 
guarantees that all function pointers are 'compatible' in the sense that 
you can cast a function pointer to a different type of function pointer 
and then back again and get a working pointer. This is the same 
guarantee that void* has for object pointers, but void* also adds 
implicit conversions for which no function pointer type has.

The xDlSym function uses that particular signature, because as you say, 
it is somewhat unlikely to be used in normal programming (it actually IS 
a useful type of function, it just needs to interact through global 
variables). It is expected that you will case the result to the proper 
type of function pointer before calling the function.

On many machines (and I believer required for POSIX) the conversion of a 
function pointer to a void* and back to the proper type of function 
pointer would work, giving you a working function pointer. It was never 
promised by the standard to work in general, and there are machines 
where it doesn't work (you just need a larger program space than data 
space).

-- 
Richard Damon

Reply via email to