Making FORTRAN libraries thread-safe?
“James D. Clippard” wrote: > I have a need to use several libraries originally written in FORTRAN as part > of a numerically intensive multithreaded application. The libraries are > currently “wrapped” with a C/C++ interface. > > —– > My question is: How might one safely accomplish such a task, given FORTRAN’s > non-reentrant static memory layout? > —– The answer is really “it depends”. Firstly, with multi-threading you are going beyond the bounds of what is possible in standard C/C++, so any solution is by definition system dependent. I’m not sure off hand if any version of FORTRAN (eg 90 or 95) has standardised support for threading, but somehow doubt it. F77 never had any standardised support for multi-threading. Second, “FORTRAN’s non-reentrant static memory layout” is not strictly true. It is definitely not true with F90 or F95. With F77 (and before) things are a little ambiguous — eg lots of vendor specific extensions — so you will need to look at documentation for your