[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Table of function pointers
From: |
Lai Kang Tin |
Subject: |
Re: [avr-gcc-list] Table of function pointers |
Date: |
Thu, 3 May 2001 13:05:03 +0800 (HKT) |
My avr-gcc's output:
venus:/opt/avr/project$ make hx.s
/opt/avr/bin/avr-gcc -mmcu=at90s8515 -DAT90S8515 -fno-builtin -Os
-Wstrict-prototypes -Wall -I./ -I/opt/avr/include -c -S -o hx.s hx.c
hx.c:6: warning: function declaration isn't a prototype
hx.c:7: warning: function declaration isn't a prototype
hx.c:9: warning: function declaration isn't a prototype
hx.c:9: declaration of `FunctionTable' as array of functions
hx.c:9: warning: Only initialized variables can be placed into program memory
area.
hx.c:9: confused by earlier errors, bailing out
make: *** [hx.s] Error 1
KTL
On Thu, 3 May 2001, Guy Robinson wrote:
> Hi,
> Can anyone explain what this error means? See source below. I can't see what
> I'm doing wrong. Thanks in advance for your help.
>
> Guy
>
> hx_2313.c:37: declaration of `FunctionTable' as array of functions
> hx_2313.c:37: Tree check: expected class 't', have 'x' (error_mark)
> confused by earlier errors, bailing out
> D:\AVRGCC\BIN\MAKE.EXE: *** [hx_2313.o] Error 1
>
>
> #include <io.h>
> #include <progmem.h>
>
> #define pint int __attribute__ ((progmem))
>
> void function0();
> void function1();
>
> pint *FunctionTable[2]() = {function0,function1};
>
> char a,b,index;
>
> void function0(){
> a =b;
> }
> void function1(){
> b =a;
> }
>
> void main(void){
>
> PRG_RDB(FunctionTable[index]()); // call function from table at index
> index++;
> }
>
>
>
>
> _______________________________________________
> avr-gcc-list mailing list
> address@hidden
> http://avr.jpk.co.nz/mailman/listinfo/avr-gcc-list
>
K.T.LAI
address@hidden