[R] DLL Memory Problem

From: Brian Habing <habing_at_stat.sc.edu>
Date: Sat 09 Apr 2005 - 01:01:55 EST


I have created a .dll file using G77 and MinGW on my PC (Windows 2000). After using dyn.load to bring it into R2.0.1, I then call the .dll through the function ccprox shown below. It returns the correct values. If I run it a second time though it returns different values, so it seems something is being placed oddly in memory.

If I unload and reload the .dll it works again the first time.

It does the same if I copy the compiled .dll over to my Windows XP machine.

Thank you for any help,

Brian Habing

The Fortran subroutine beings with:

	subroutine ccprox(nexmn,nitem,respmat2,covmatr,covmatt,
      $               cormatr,cormatt)

!ccccc This subroutine will calculate all the pairwise
!ccccc conditional covariances. An ending r means for
!ccccc rest score, an ending t means for total score.

        parameter (maxitem=100,maxexmn=10000,maxcats=10,ncells=1001)

!ccccc ncells must be maxitem*maxcats+1

	integer nexmn,nitem,scoretemp,mscore
	integer	respmat(maxexmn,maxitem)
	integer	tscore(maxexmn) /maxexmn*0/
         integer tstemp(maxexmn) /maxexmn*0/
	integer natscore(ncells) /ncells*0/
         integer natemp(ncells) /ncells*0/
         integer i,j,k,l
	integer tcountt,tcountr,tcountt2,tcountr2
	real*8 respmat2(maxexmn,maxitem)
	real*8 pisum(ncells),plsum(ncells),pilsum(ncells)
	real*8 qisum(ncells),qlsum(ncells),qilsum(ncells)	
	real*8 pi2sum(ncells),pl2sum(ncells)
	real*8 qi2sum(ncells),ql2sum(ncells)
	real*8 covmatr(maxitem,maxitem),cormatr(maxitem,maxitem)
         real*8 covmatt(maxitem,maxitem),cormatt(maxitem,maxitem)
	real*8 sisl

The R function that is calling it is as follows (inputdata is a 400x10 matrix of 0's and 1's
in the example I have been trying).


   respmat2<-matrix(0,nrow=10000,ncol=100)    respmat2[1:nexmn,1:nitem]<-as.matrix(inputdata)    if (is.loaded("ccprox_")==TRUE){

       covmatr,covmatt,cormatr,cormatt))    list(covmatr=x[[4]][1:nitem,1:nitem],covmatt=x[[5]][1:nitem,1:nitem],

     warning("ccprox.dll was not loaded")


R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat Apr 09 01:05:44 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:05 EST