subroutine minpack_hybrd1(fcn, n, x, Fvec, Tol, Info, Wa, Lwa, udata) &
& bind(c)
procedure(minpack_func) :: fcn
integer(c_int), value :: n
integer(c_int), intent(out) :: info
real(c_double), value :: tol
real(c_double), intent(inout) :: x(n)
real(c_double), intent(out) :: fvec(n)
integer(c_int), value :: Lwa
real(c_double), intent(inout) :: Wa(Lwa)
type(c_ptr), value :: udata
call hybrd1(wrap_fcn, n, x, fvec, tol, info, Wa, Lwa)
contains
subroutine wrap_fcn(n, x, fvec, iflag)
integer, intent(in) :: n
real(wp), intent(in) :: x(n)
real(wp), intent(out) :: fvec(n)
integer, intent(inout) :: iflag
call fcn(n, x, fvec, iflag, udata)
end subroutine wrap_fcn
end subroutine minpack_hybrd1