CW problem with handling of function pointers

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

CW problem with handling of function pointers

1,019 Views
Sunil_Reddy
Contributor I

Hi 
I am working with CW version 10 and using HS08 MCU. THe 
problem seems to be CW having the problem with handling the 
function pointers. 
in detail: When I go through single step debugging, CW is not 
finding the link, at this stage the CW is jumping out of the 
function and giving error. The location where CW is not finding the 
link is "GUI_Context.pAFont->pfDispChar(c);" 
GUI_Context is a structure; 
pAFont is GUI_COntext variable; 
pfDispChar is function pointer in pAFont structure' 


thanks 
Sunil

Labels (1)
Tags (1)
0 Kudos
3 Replies

535 Views
CrasyCat
Specialist III

Hello

 

Where is the calling function located (address)?

Where is the called function located (address)?

 

Which memory model are you using (tiny, small, ...)?

 

If you look at the disassembly window what is the code generated for the function pointer invocation?

 

CrasyCat

0 Kudos

535 Views
Sunil_Reddy
Contributor I

Hi ,

My code flow is like this  Main() -> GUI_DispCharAt( char c, int, int) -> GL_DispChar(c) -> GUI_Context.pAFont->pfDispChar(c);

 

the address of each of the above routines are:  Main(): 0x 4a69

 

Where is the calling function located (address)?:  GL_DsipChar(c): 0x2bc6

Where is the called function located (address)? :GUI_Context.pAFont->pfDispChar(c); 0x20ef

GUI_Context

 

I am attaching 3 files (print screen), 2 of them gives you the address of the above functions and 3rd one shows the error after executing the GUI_Context.pAFont->pfDispChar(c); 

 

GUI_Context si strcuture; 

paFont is member of GUI_context

pfDispChar () is function and member of paFont


Which memory model are you using (tiny, small, ...)? its default one i.e., small 

 

If you look at the disassembly window what is the code generated for the function pointer invocation?: can not see the code generated after this compiler jumping out from the location and giving an error (see the error file attached)

 

Thansk

Sunil 

 

Attachments:

error.png 243 KB

GL_DispChar_Address.png 266 KB

GUI_DispCharAt_Address_routine.png 261 KB

0 Kudos

535 Views
CrasyCat
Specialist III

Hi

 

How is your function pointer defined?

 

CrasyCat

0 Kudos