I ran into something that I totally don't understand. There is a prototype function:
typedef void ( * TMain ) ( void );
and function variable:
TMain myFunc = MyFunc; ... myFunc ();
This works great, of course. Why not.
From the MAP file, I know that “MyFunc” is at location 0x20100. And now the funniest thing. After assigning "myFunc = MyFunc;" the variable "myFunc" does not contain the value 0x20100, but rather 0x20101!
My problem is that I need to call a function from which I know the address from the table. So I thought I could do it like this
myFunc = ( TMain ) myTable [ 5 ];
However if i do
myFunc = ( TMain ) ( ( Int8 * ) myTable [ 5 ] + 1 ); myFunc ();
then it works.
What's going on here? Should I always add offset 1 or is it more or less random? Or is there a better (and working) way to accomplish a task?
Thanks so much for any hint. Walter
source share