michael rushton

S12X CW4.5 function pointers

Discussion created by michael rushton on May 11, 2006
Latest reply on May 16, 2006 by CrasyCat
S12XDP512, CW 4.5, LARGE memory model
I have a function pointer defined as
typedef void (*function)(void);
I have a void pointer which is holding the function address  0x7DB089'G ( which is actually laid out in memory as B0897D.
When I attempt to cast it (or call it) the runtime GLOBAL_TO_LOCAL function is called. The result is
0x7DC289 (or  C2897D as laid out in memory). This is incorrect and crashes the code.
Any suggestions how I can get around this. I'm guessing that the routine assumes this is a data pointer and not a function pointer?