I will look into using inline, but since the Fortran code is several thousand lines long & is comprised of multiple subroutines, compiling it into a shared object & dynamically loading it into R is probably the easier solution.
I have also noticed a strange numerical problem when calling the routine from within R as opposed to in its native Fortran. For example, for the same set of input parameters, R will output; (0.0315031507927081, 0.220339391742628) Whereas the Fortran code internally outputs; (0.0350479965640488472, 0.22220883087569138) All variables are defined in the Fortran code as double, and are passed in as double in the .Fortran call in R. I am a bit puzzled at the discrepancy between the two calls' output. -- View this message in context: http://r.789695.n4.nabble.com/Trouble-returning-2D-array-into-R-from-Fortran-tp4646862p4646874.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.