I have a function that takes following argument:
int setvalue(void (*)(void *));
In order to satisfy parameter: void (*)(void *)
, I created a function like this:
static void *freeFunction(void *freeAbc)
{
AllocAbc *abc = (AllocAbc*) freeAbc;
if (abc)
{
delete abc;
}
return NULL;
}
And I'm trying to use both together as :
AllocAbc *allocAbc = new AllocAbc();
...
void *freeAbc = (void *) allocAbc;
if (setvalue (freeFunction(freeAbc)) < 0)
{
...
}
I get an error saying error: invalid conversion from ‘void*’ to ‘void (*)(void*)’ [-fpermissive]
What should be changed here (either in freeFunction definition or the way I use both) to make it work.
Thanks.