The prototype for the compare function parameter for qsort is
int (*compar)(const void *, const void *)
and given this, the Fortran function interface shall indeed be type(c_ptr), intent(in), value. So it’s not an alternative, it’s the approach to be taken…