Quitter3
June 21st, 2002, 03:44 AM
I have made a testprogram in Visual Studio, which uses a functionpointer like this:
Str1, Str2 and Str3 contain the functionaddresses retreived out of the mapfile.
#include "stdargs.h"
void (*pfunc)(...);
memcpy(&pfunc,Str1,4);
pfunc();
memcpy(&pfunc,Str2,4);
pfunc(20);
memcpy(&pfunc,Str3,4);
pfunc(20, "test");
This works great.
But I really want to use this in an embedded ARM system. So I wrote the same code in an ANSI C file for ARM.
For compiling I use the ADS compiler. But this compiler errors on the (...) in the pointer declaration.
When I leave the ... away like this:
void (*pfunc)();
it does not come up with any errors. But I still call functions with 1 or 2 parameters.
Can anyone tell me if this is possible in ANSI C?
And if it is, is it a compiler bug or am I doing something wrong?
Str1, Str2 and Str3 contain the functionaddresses retreived out of the mapfile.
#include "stdargs.h"
void (*pfunc)(...);
memcpy(&pfunc,Str1,4);
pfunc();
memcpy(&pfunc,Str2,4);
pfunc(20);
memcpy(&pfunc,Str3,4);
pfunc(20, "test");
This works great.
But I really want to use this in an embedded ARM system. So I wrote the same code in an ANSI C file for ARM.
For compiling I use the ADS compiler. But this compiler errors on the (...) in the pointer declaration.
When I leave the ... away like this:
void (*pfunc)();
it does not come up with any errors. But I still call functions with 1 or 2 parameters.
Can anyone tell me if this is possible in ANSI C?
And if it is, is it a compiler bug or am I doing something wrong?