Home > User Support > CoverageMaster winAMS FAQ

CoverageMaster winAMS FAQ

Test Data Settings

514_01: When testing a function with a function pointer, how to specify a function address to the function pointer?

Question:

When testing a function that includes a function pointer as an input variable, I have to re-enter the address value each time after compiling because the function's mapped address changes. How should I specify the function address?

Ex.)
     /* Test Target */
     int exec_func(int (*func) (void)){
          int eRet = -1;
          if(NULL != func) {
               eRet = (func) ();
          }
          return eRet;
     }

     /* The function which is called by the function pointer */
     int subfunc(void) {
          return 1;
     }
     

Answer:

When specifying a function pointer as an input, the function symbol name can be used as the input data. With the above example, the function symbol name "subfunc" can be entered as the test data for the function pointer.

 

Related Technical Tips Search

Other technical tips in GAIO's web site can be searched for using the links below.

Search key word link: Function Pointer
Technical Tips Google Search


Information Links