Function Pointer

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Function Pointer

Jump to solution
1,035 Views
Skippy
Contributor II

I am working on  a small cooperative scheduler for a 9s08 project. The scheduler dynamically fills an array of structures with information for each task to be run by the scheduler. One of the pieces of data is a function pointer to the target task.  The function pointer definition in the struct looks like this:    unsigned int (*pTask)();

The complier (CW Dev Studio V6.2) does not emit a peep during compile/link.  But, when running debug on the hardware and stepping through the function that is supposed to pickup the functional pointer and launch the function we investigate the structure at the point where the code picks up the pointer and see:  "undefined function () returning unisgned int.  Should the functional pointer in the struct be declared as a __far since the target function is not in the local data area?  Any help would be appreciated. Thanks in advance.

Labels (1)
Tags (1)
0 Kudos
1 Solution
370 Views
Skippy
Contributor II

Thought I'd share this... 

Definition of the function pointer as a struct member:

typdef  ABC_T

{

    void (*pTaskName)(void);

    .

    .

}astruct_t;

  

Then, calling the function:

 

(*astruct_t[Index].pTask)(); 

 

 

View solution in original post

0 Kudos
1 Reply
371 Views
Skippy
Contributor II

Thought I'd share this... 

Definition of the function pointer as a struct member:

typdef  ABC_T

{

    void (*pTaskName)(void);

    .

    .

}astruct_t;

  

Then, calling the function:

 

(*astruct_t[Index].pTask)(); 

 

 

0 Kudos