Say I have a function f(a, b, c)
. Is it possible to create function pointers g
and h
such that when you use g
and h
they use a predetermined value for one of the arguments?
For example (*g)(b, c)
would be equivalent to f(1, b, c)
and (*h)(b, c)
would be equivalent to calling f(2, b, c)
.
The reason why I am doing this is that I am calling a function to which I can obtain a pointer (through dlsym) and this function has drastically different behaviour depending on what the first argument is (so much so that they shouldn't really be called the same thing). What's more the function pointer variable that is being used in the main program can only generally take two arguments as this is a special case where the imported function has three (but really only two are necessary, one is essentially a settings parameter).
Thanks.