This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

RE: enabling OVERLAY only for some func

Bahri Okuroglu

Turning off overlaying to use function pointers has a heavy ram size price.

Since function pointers are tricky to use, I suggest the following technique. This technique has 2 advantages. The call tree is built automatically by the linker. Also you need only save and pass a char enum instead of a larger function pointer. This usually offsets the cost of the extra array evaluation.

extern char Fn1( char, char );
extern char Fn2( char, char );
extern char Fn3( char, char );

typedef char FnT( char, char );
enum {eFn1, eFn2, eFn3 };
FnT* code pFns[] = { &Fn1, &Fn2, &Fn3 };

void main( void )
{
  char a = (*pFns[ eFn2 ])( 1, 100 );
}

0