[Rd] f2c to achieve reentrancy in odesolve?

Mike Prager mike.prager at noaa.gov
Fri Nov 24 17:27:39 CET 2006

Setzer.Woodrow at epamail.epa.gov wrote:

> I am beginning a much-delayed update of odesolve to include several
> ordinary differential equation solvers from the Livermore package
> ODEPACK.  These are much-used and reliable Fortran codes, and I plan (as
> I did for lsoda in the current odesolve package) to make as few changes
> as possible to the Fortran 77 code.  However, recently someone wanted to
> make nested calls to lsoda, which will not work, because Fortran is not
> generally reentrant.  I understand I can use f2c to convert the codes to
> C, which would then gain reentrancy, and that there are parts of R which
> were translated from Fortran to C for just this reason (at least, I read
> that in an earlier R-help message).  My questions to this group are:
> 1) Will this indeed automatically make the solvers reentrant?
> 2) How much do I need to worry about changed numerical behavior of the C
> version of the solvers after translation?
> 3) Are there special considerations not covered in R-exts for code
> translated with f2c?
> 4) Is there a better way to make the Fortran solvers reentrant?
> R. Woodrow Setzer, Ph. D.

Hello, Woodrow.

Fortran 95 may be better than Fortran 77 in that regard (it does
allow recursive calls).  However, it is not an area I have
experience with.  

I suggest that you post your question to Usenet group
comp.lang.fortran.  Many highly experienced Fortran users
populate that group, including several members of the standards
committee.  I can't think of a better place to get advice on
such a question.


Mike Prager, NOAA, Beaufort, NC
* Opinions expressed are personal and not represented otherwise.
* Any use of tradenames does not constitute a NOAA endorsement.

More information about the R-devel mailing list