Modules in a Fortran project are exchanging data by mean of saved variables. That works fine even if I don't like the design.
Now, I have to call a subroutine externally inside a C++ loop. The problem is that there is no way to reset the state of the program each call. The called Fortran subroutine retains information from the previous call.
Excluding total rewrite of the Fortran code, since there are too many saved variables and they seem quite organized, how can I destroy these variables each successive call from C++ so that each call is like a fresh new ?