There are some fundamental problems here for languages like C and Fortran, more details here: Funarg problem - Wikipedia.
With C++ the situation is a bit different; lambdas and std::function
work well when used within the confines of C++, but as @certik has just alluded, it faces the same limitations when trying to pass code and data across language boundaries.
For example a lambda function can be converted to a C compatible function pointer, only under certain restrictions, namely that it doesn’t capture any variables from the enclosing scope.
As @themos has written before,
Personal take: The essence of Fortran is that all executable code is present at program start. Fortran will not compose executable code at runtime, and if it ever does it shouldn’t be called Fortran anymore. In Fortran, data comes and goes but code is written in stone.
To tie back to what @certik said,
To achieve the parameterized function while preserving reentrancy, the solver
would need to “open” a way to pass data (in C this would be the void *
omni-parameter).