Posts

Showing posts with the label fortran

R studio crashing when calling a Fortran module

R studio crashing when calling a Fortran module I am trying to call a module written in Fortran in R studio, but the latter unexpectedly crashes. I have tried with other Fortran examples (factorial and MC estimation of pi) and these worked well. The only difference I see between my code that don't work and those examples is that I used a subroutine wrapper for my pure function (calling other pure function) whereas these examples were only relying on subroutines and the fact my function has a vector as input. Here is the procedure I have followed (or code typed in): R CMD SHLIB mypath/myfile.f90 #this compiles without problem; code supplied below. dyn.load('ptoh') #This is just the given name of the wrapper subroutine .Fortran('ptoh', dimen=as.integer(dimen), p=as.matrix(p), m=as.integer(m), h=integer(1) ) where I arbitrarily set in R: dimen<-3; p<-c(4,6,7); m=3; dimen<-3; p<-c(4,6,7); m=3; Do you have any idea of why is it crashing? Is the way of ...