I realize that far is compiler specific, but my expectation is that the placement of the far specifier should make sense to those who really understand pointers.
So, I have two applications that share the processor's entire memory space.
App A needs to call function foo that exists in app B.
I know the memory location of function foo.
So this should work, in app A:
typedef int (* __far MYFP)(int input);
void somefunc(void)
{
int returnvalue;
MYFP foo;
foo = (MYFP) 0xFFFFFA;
returnvalue = foo(39);
}
- Is the __far in the right spot in the typedef?
- Do I need to add __far to the (MYFP) cast?
- Some information suggests that the call to foo doesn't need to be dereferenced, what is your experience?
What else about this looks incorrect, or might I try to accomplish this?
Is there a better way to do this?
Edit:
This is on an embedded device (Freescale S12XEQ device) using Code Warrior. It's a 16 bit device with 24 bit memory space, so yes, it is segmented/banked.