You don’t need anonymous functions for this. Your Matlab example is also not anonymous in the end, it has a name g
.
Fortran internal functions are of great use here (Fortran 2008 feature, but supported in gfortran and ifort, not supported in Solaris Studio):
call minimum(g, x0, xopt)
contains
real function g(x)
real, intent(in) :: x
g = f(x,data)
end function
end