Hello:
Was trying to assign a function pointer to a struct member and am getting compile errors. The .h file I have to use has defined the struct:
typedef void(*callback)(bool, char*, int, unsigned long, void *);
struct CallbackInfo
{
callback func;
void* stuff;
};
What I have in my C++ file is:
static void foo(bool val, char* a, int b, unsigned long c, void * stuff)
{
...
...
}
int funXYZ ()
{
CallbackInfo callbackInfo;
callbackInfo.func = foo; // compiler error right here
callbackInfo.stuff= NULL;
...
...
}
The error I get is:
value of type "void (*)(bool, char*, int, unsigned long, void *)"
cannot be assigned to an entity of type "callback"
> callbackInfo.func = foo;
Any help is greatly appreciated.
Thank you.