D
daniel rich
Hello All,
I have been wrestling with a problem, and my others searches have failed so I wanted to ask here.
Thanks in advance for any thoughts/help.
I currently have some code that looks something like this.
someHeader.h
"
typedef void (* proj_getNameFuncPtr) (char* nameBuffer );
void proj_getName( char* nameBuffer );
"
someFile.c
"
void proj_getName(char* nameBuffer )
{
//implement
}
"
Ideally I was hoping to do something like the following instead, so that I can reduce the code duplication. In the actual project there are quite a few of these and
maintaining the signature in both the typedef'd func pointer and the function dec'l is a pain.
newHeader.h
"
typedef void proj_getNameFunc( char* nameBuffer );
typedef proj_getNameFunc* proj_getNameFuncPtr;
proj_getNameFunc proj_getName;
"
newFile.c
"
void proj_getName(char* nameBuffer )
{
//implement
}
"
The compiler I am using(msvc71) chokes on "typedef proj_getNameFunc* proj_getNameFuncPtr;" and complains.
"error: expected '=', ',', ';', 'asm' or '__attribute__' before * token"
I want to keep the func pointers around since we do end up using quite a few of them in function signatures. I may be doing things the totally wrong way but would appreciate any correction/help that could be provided.
--Daniel Rich
I have been wrestling with a problem, and my others searches have failed so I wanted to ask here.
Thanks in advance for any thoughts/help.
I currently have some code that looks something like this.
someHeader.h
"
typedef void (* proj_getNameFuncPtr) (char* nameBuffer );
void proj_getName( char* nameBuffer );
"
someFile.c
"
void proj_getName(char* nameBuffer )
{
//implement
}
"
Ideally I was hoping to do something like the following instead, so that I can reduce the code duplication. In the actual project there are quite a few of these and
maintaining the signature in both the typedef'd func pointer and the function dec'l is a pain.
newHeader.h
"
typedef void proj_getNameFunc( char* nameBuffer );
typedef proj_getNameFunc* proj_getNameFuncPtr;
proj_getNameFunc proj_getName;
"
newFile.c
"
void proj_getName(char* nameBuffer )
{
//implement
}
"
The compiler I am using(msvc71) chokes on "typedef proj_getNameFunc* proj_getNameFuncPtr;" and complains.
"error: expected '=', ',', ';', 'asm' or '__attribute__' before * token"
I want to keep the func pointers around since we do end up using quite a few of them in function signatures. I may be doing things the totally wrong way but would appreciate any correction/help that could be provided.
--Daniel Rich