Hi, I have written a simple 8051-application using uVision2 V2.37. I have defined a function which expects a pointer to a function which is then saved in an array of function pointers: int registerFunction( void (*Fct) (void) ) { .... functArray[i] = Fct; .... } calling the function "(*functArray[i])()" fails. As far as I have heard when passing any kind of pointers as parameters the keyowrd "xdata" have to be used in the declaration and the definition of the functions: int foo(int* xdata var); I have tried to use "xdata" in my function declaration, but the compiler did not allow that. Does anybody know how to pass a function pointer as a parameter ?? Best regards hammoud
calling the function "(*functArray[i])()" fails Fails --- how? the keyowrd "xdata" have to be used That's quite probably misinformation, or wrongly interpreted by you. Care referencing the source of this statement? All that said, the most important answer you need is that this is not at all a good technique to use on a '51. Function pointers wreak havoc with call tree analysis, causing all kinds of nasty problems. See the sections about function pointers in the manual