I have a function header in a library that looks like this:
void deepCopy(CList ** clone, CList * cl, void * (* data_clone) (void * d));
I am having tremendous difficulty in passing it the deep_clone function properly.
This is what I am trying currently
CList *ys2 = &ys;
void (*dc) (void *) = &data_clone;
void (**dc2) (void *) = &dc;
deepCopy(&ys2, &xs, dc2);
The gcc output is:
testclist.c: In function ‘test_deep_copy’:
testclist.c:504: warning: passing argument 3 of ‘deepCopy’ from incompatible pointer type
I have tried cdecl.org on my declaration of dc2, and it says it is what I assume would be correct.
Any help is much appreciated; thank you.
The function is not expecting “a pointer to a pointer to a function”, it’s expecting simply a pointer to a function.
should suffice.