I'm writing a Linux device driver that needs to compile with several
different Linux versions. In my code, I need to reference certain
functions by their address alone. Something like this:
int myfunc(char *x);
if (memory_test[x] == myfunc)
....
In other words, I don't care about the return values or the parameters
of myfunc(), I just need to reference it.
In my case, myfunc() isn't a function that I've defined, but it may be
declared in a header file that I'm including. The problem is that each
Linux version has different header files for myfunc(), so that I can't
really know which header file I need to include in order to get
myfunc() declared. Not only that, but the function declaration for
myfunc() isn't exactly the same, either.
Therefore, I was hoping for something like this:
#if !defined(myfunc)
void myfunc(void);
#endif
This doesn't work, of course, because myfunc() is not a macro, so
defined() doesn't work on it. All I want to do is create a prototype
for myfunc() that is guaranteed not to cause any function redefinition
errors.