Hi, I use RealView MDK_ARM
I want to define a functionpointer in the __FILE struct (stdio.h). By changing this functionpointer in my mainprogram I can redirect stdout to some device.
To do this I changed the file retarget to following
#include <stdio.h> extern "C" { struct __FILE { int handle; int *(*stdoutProc)(int ch); //THIS IS THE FUNCTIONPOINTER I CREATED }; FILE __stdout; FILE __stdin; InitStdOut(int *MyStdOut(int Ch)) { __stdout.stdoutProc = MyStdOut; } int fputc (int ch, FILE *f) { __stdout.stdoutProc(ch); return(ch); } } //extern C
I did not test the code, so maybe the code doesn't do the thing I want to do, but however I can compile it without errors !
When I rename all the files to *.cpp, to use the compilers C++ extentions, I have the error (at the line FILE __stdout;) error #70: incomplete type is not allowed
How can I add a functionpointer to the __FILE struct in C++ environment ?
Thank you