I found a book that says that if you want to use a function from the standard C library that takes a function pointer as an argument (e.g. qsort), the function to which you want to pass the function pointer must be a C function and therefore declared Like extern "C".
eg.
extern "C" {
int foo(void const* a, void const* b) {...}
}
...
qsort(some_array, some_num, some_size, &foo);
I would not be surprised if this is simply incorrect information, however - I am not so sure: is this correct?
source
share