Dear ExpeRts! I have problem with sending data to FORTRAN subroutine on Windows XP and R 2.1.1. When I call it using .Fortran, I get the following error: R for Windows GUI front-end has encountered a problem and needs to close. We are sorry for the inconvenience. Error signature AppName: rgui.exe AppVer: 2.11.50620.0 ModName: read.dll ModVer: 0.0.0.0 Offset: 00001683 It seams that the error is somehow related to the size of the data. Here are the calls: dyn.load("C:/ales/b_for/read.dll") #The FORTRUN subroutine used to create the "read.dll" ("read.f") is attached (and in case something happens to the attachment also at the end of the mail. n<-as.integer(134);k<-as.integer(2);M<-matrix(as.double(rnorm(n=n^2)),nrow=n,ncol=n);.Fortran("read",M=M,n=as.integer(n),clu=as.integer(sample(1:k,size=n,replace=TRUE)), k=as.integer(k),diag=as.integer(1),err=as.double(0.0),E=matrix(as.double(0),ncol=k,nrow=k), BM=matrix(as.double(0),ncol=k,nrow=k)) #This works ok n<-as.integer(134);k<-as.integer(4);M<-matrix(as.double(rnorm(n=n^2)), nrow=n,ncol=n);.Fortran("read",M=M,n=as.integer(n),clu=as.integer(sample(1:k,size=n,replace=TRUE)), k=as.integer(k),diag=as.integer(1),err=as.double(0.0),E=matrix(as.double(0),ncol=k,nrow=k), BM=matrix(as.double(0),ncol=k,nrow=k)) #Now the k is incrised form 2 to 4 and the error occours. n<-as.integer(40);k<-as.integer(4);M<-matrix(as.double(rnorm(n=n^2)),nrow=n,ncol=n);.Fortran("read",M=M,n=as.integer(n),clu=as.integer(sample(1:k,size=n,replace=TRUE)), k=as.integer(k),diag=as.integer(1),err=as.double(0.0),E=matrix(as.double(0),ncol=k,nrow=k), BM=matrix(as.double(0),ncol=k,nrow=k)) #If I leave the k at 4 and reduce the n to 40, then it works. Any suggestions are welcomed. Thank you in advance! Best regards, Ales Ziberna The commands used to generate "read.dll". g77 -c read.f R CMD SHLIB read.o The FORTRAN subroutine ("read.f"): subroutine read(M,n,clu,k,diag,err,E,BM) INTEGER n, clu, k, i, j, ii, nA, nAD DOUBLE PRECISION M, E, BM, A, AD, vecA, vecAD, err, mean, temp, ss LOGICAL diag DIMENSION M(n,n), clu(n), E(k,k), BM(k,k), A(k,k,n*n), AD(k,n), nA(k,k), nAD(k), vecA(n*n), vecAD(n) end