I have two callback tables. Depending on a certain initialization flag, I use one or the other table, but the module that uses the call back table should not have knowledge of this flag. This module only has a pointer to a callback table. Unfortunately, all the routines do not take the same number of arguments.
I have come to the conclusion that I cannot have a single jump table with functions with variable arguments. After some discussion, I have decided to go ahead and embed arrays of pointers to functions within a structure. The call back table pointer would just point to the correct structure.
For example,
struct CallTbl
{
void (* Error)(ulong);
void (* Validate)(struct foo *);
int (* CalcDiff)(struct foo2, usigned int, struct foo *);
where struct CallTbl * TblPtr and struct foo Record
I'll go ahead and do this unless someone has any better ideas.
My other choice was to have to look at this initialization flag whenever a call back had to be made, but then this would violate the fact that the module is not supposed to know the value of the flag.