[opensuse-programming] How do you initialise a static table with external function pointers?
I've got some code that looks roughly like this: (global scope) : static struct action process_table[] = { { 0, process2_250 }, { 1, process2_550 }, . . . }; process2_250 and process2_550 are external references, but intended to be resolved at link time, not load time. When I compile I get "error: initializer element is not constant". Can this be made to work? /Per Jessen, Zürich --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-programming+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-programming+help@opensuse.org
Per Jessen wrote:
I've got some code that looks roughly like this: (global scope) :
static struct action process_table[] = { { 0, process2_250 }, { 1, process2_550 }, . . . };
Additional info: extern PROCESS_FUNC *process2_250, *process2_550 .... struct action { int type; PROCESS_FUNC *action; } PROCESS_FUNC is a typedef for a function prototype. I've solved the problem - I've changed 'action' to: struct action { int type; PROCESS_FUNC **action; } and the initialization: static struct action process_table[] = { { 0, &process2_250 }, { 1, &process2_550 }, . . . }; /Per Jessen, Zürich --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-programming+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-programming+help@opensuse.org
participants (1)
-
Per Jessen