|ARM Technical Support Knowledge Articles|
Applies to: C51 C Compiler
Information in this article applies to:
Calls to a reentrant function will not pass parameters on the reentrant stack if the reentrant function is prototyped incorrectly.
Reentrant functions (functions declared with the reentrant keyword) receive parameters from the simulated stack. Functions that call reentrant functions must store arguments on the simulated stack prior to calling the function. To properly pass arguments, the C51 compiler must know whether or not a function is reentrant. Function prototypes for reentrant functions must include the reentrant keyword. For example:
void func ( long a, long b, long c);
is a prototype for a function that returns nothing and that requires three arguments. This function (func) is not prototyped as a reentrant function. If the function is indeed reentrant, calls to func will fail to pass parameters on the reentrant stack and func will fail to perform as expected.
To correct this problem, be sure that prototypes for reentrant functions include the reentrant keyword. For example:
void func ( long a, long b, long c) reentrant;
Article last edited on: 2004-06-29 14:14:47
Did you find this article helpful? Yes No
How can we improve this article?