Skip to content
Prev 359035 / 398503 Next

ALLOCATE in a FORTRAN subroutine

The question belongs on the R-devel mailinglist.

I do not think you can do what you describe, if I read your question correctly.
You are calling your Fortran routines directly from an R file with .Fortran, I presume?

Your other solution: I don't really understand what you are implying.
Declare them with (:,:) or (*,*), allocate and the return the array? A Fortran95 pointer?
I think  all of that is just a no no.

Is it possible to calculate the required size of the array in a separate routine given some parameters (as can often be done with Lapack routines) before calling the main subroutine?
If so, call the sizing routine and then declare the correctly sized array in your R code and pass it to the main subroutine.

Berend