Hello all,
I have a little problem with what seems to be a standard gcc error.
I am developping a little application for 8bit microcontroller and I need to create a jumptable, because access is a key to save space.
Typically, I have:
>>>>>>>
void func1()
{...}
void func2()
{...}
unsigned short globalVar = &func2() - &func1();
int main()
{return globalVar;}
<<<<<<<
I get the error:
"[...] error: initializer element is not computable at load time"
Of course, it relates to the initialisation of "globalVar" parameter. What I don't understand is, that func1 and func2 should have a fixed address and location. So, why does the gcc compiler does not want to initialize my global variable?
(of course, this is only an example, at the end, I should have a structure/array with all function adress, but the problem is still initializing the global parameter with function's address).
Does anyone know a tips to help solve this issue?
Thank you in advance, gentlemans !
Fred