Declaration of functions called via function pointers 
Author Message
 Declaration of functions called via function pointers

I have a typedef (or actually a large amount of typedef's like this)
of a callback function that looks like this:

typedef RPH_waitType (* cp_rphXsrphCallback)
  (cp_instance instance,
   cp_side side,
   int sendBlock,                                 /* CP block that executed XSRPH */
   int orderCode,
   int rpAddress,
   cp_register reg,
   void* clientData);                             /* From cp_rph_add() */

In the function, I would like to "reuse" the parameter declaration
from this typedef to avoid (future) mistyping.

RPH_waitType cp_executeXsrphInstruction(
  (cp_instance instance,
   cp_side side,
   int sendBlock,                                 /* CP block that executed XSRPH */
   int orderCode,
   int rpAddress,
   cp_register reg,
   void* clientData)                              /* From cp_rph_add() */
{

Quote:
}

Can anyone recommend a method of achieving this?
I could make a macro of the parameters, but then I won't
see the parameters to the function, only a macro name,
but I guess I cannot go around that?

typedef RPH_waitType (* cp_rphXsrphCallback) (XSRPH_PARAM)

RPH_waitType cp_executeXsrphInstruction(XSRPH_PARAM)
{

Quote:
}

Thanks,
Bo


Mon, 06 May 2002 03:00:00 GMT  
 Declaration of functions called via function pointers
Quote:
> typedef RPH_waitType (* cp_rphXsrphCallback) (XSRPH_PARAM)

> RPH_waitType cp_executeXsrphInstruction(XSRPH_PARAM)
> {
> }

Mr. Young asked this a short while ago;  you
might define the function using the typedef:

  cp_rphXsrphCallback cp_executeXsrphInstruction;

Later when you declare the function with a body,
you are not allowed to change the type (it will
give a "different redefinition of symbol".)



Mon, 06 May 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. C++ Noob: Calling an extrnal function via pointer.

2. How to use (pointer to function), and function and pointer to (pointer to function)

3. Pointers to pointers to functions declaration

4. Validity of simplified notation for calling functions from function pointers

5. Pointer Functions and Pointers to Pointer Functions

6. Call a function in a function with name of a function as parameter

7. Function declaration/calling fun:

8. Condition breakpoints and function calls and function calls in Immediate window

9. Calling a function not in mainfrm via ON_COMMAND

10. Arrays, Functions, and Returning Pointers via Parameters

11. Declaration of pointer to function

12. function pointer declaration question

 

 
Powered by phpBB® Forum Software