Sunday, 11 August 2013

unable to load in R a Fortran dll reading a file

unable to load in R a Fortran dll reading a file

I have creating a simple Fortran subroutine counting the lines of a given
file and I cannot load it into R as a dll, I use to create Fortran dll for
a while and they usually correctly work when calling in R, here is the
Fortran subroutine :
subroutine countlines(fname,nl)
character(len=20), intent(in):: fname
integer, intent(inout):: nl
integer :: ios
character(len=1) junk
open(unit=7, file=fname, status='old', iostat=ios)
if (ios .ne. 0) then
write(*,*) fname, 'cannot be opened !'
go to 20
end if
ios = 0
nl = 0
do while (.true.)
read(7,*,iostat=ios) junk
if (ios .ne. 0) exit
nl = nl + 1
enddo
close(7)
stop
20 write(*,*)'I/O error reading file !'
end subroutine countlines
when creating the dll, R cannot load it and as it is the first time I am
trying to create a dll using open, close, read and write functions I guess
they are in cause but I do not know why and how I could solve this
problem, could anyone help me please ?

No comments:

Post a Comment