[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] calling function pointers via pointers ?
From: |
Vincent Trouilliez |
Subject: |
[avr-gcc-list] calling function pointers via pointers ? |
Date: |
Wed, 28 Sep 2005 11:53:55 +0200 |
Hi list,
Another pointer problem again, oops...
I need pointers to functions in my project. Using the great on-line
resource http://www.eskimo.com/~scs/C-faq/q4.12.html which someone on
here mentioned recently, I got the basics working.
But my actual case at hand is a bit trickier and I am lost again (okay,
doesn't take much to loose myself I admit ;-).
Problem: my function pointers are in an array, within a structure, which
itself is accessed via pointers... oh dear.
The essence of my code follows, I need expert advice on how to access
these pointers in order to call the functions...
Regards,
--
Vince
//data type for a menu
struct menu {
.....;
.....;
int (*fp)()[]; //table to store all the pointers
};
//definition for a menu
const struct menu __ATTR_PROGMEM__ menu_foo = {
.....,
.....,
{fn1, fn2, ... }
};
//run the specified menu using the structure passed as argument
void menu_run(const struct menu * p)
{
int r;
.....
r = (p->fp[0])(); //call the first function
.... //syntax ???....
....
}
- [avr-gcc-list] calling function pointers via pointers ?,
Vincent Trouilliez <=
- Re: [avr-gcc-list] calling function pointers via pointers ?, Lars Noschinski, 2005/09/28
- Re: [avr-gcc-list] calling function pointers via pointers ?, Thomas Buchta, 2005/09/28
- Re: [avr-gcc-list] calling function pointers via pointers ?, Vincent Trouilliez, 2005/09/28
- Re: [avr-gcc-list] calling function pointers via pointers ?, Joerg Wunsch, 2005/09/28
- RE: [avr-gcc-list] calling function pointers via pointers ?, stevech, 2005/09/29
- Re: [avr-gcc-list] calling function pointers via pointers ?, Joerg Wunsch, 2005/09/29
- RE: [avr-gcc-list] calling function pointers via pointers ?, Vincent Trouilliez, 2005/09/29
- RE: [avr-gcc-list] calling function pointers via pointers ?, Vincent Trouilliez, 2005/09/29
- Re: [avr-gcc-list] calling function pointers via pointers ?, David Brown, 2005/09/29
- Re: [avr-gcc-list] calling function pointers via pointers ?, Dave Hansen, 2005/09/28