Software Archive
Read-only legacy content
17060 Discussions

Dimensioning Arrays

Intel_C_Intel
Employee
594 Views
I am new to Fortran, so I hope this question is not too simple.
I have a fortran dll, being called by vb 6.0, and in the dll, I am having a problem using automatic arrays.
For example, in the following line of code, NoComp=3, NoChain=1, but when I use quickwatch, InitInv is set up as an array with greter than 1000 elements (array expansion limited to 1000 nodes)
REAL(KIND=8), Dimension(NoComp*NoChain)::InitInv
Any help would be appreciated,
Ciara
0 Kudos
3 Replies
Steven_L_Intel1
Employee
594 Views
Are NoComp and NoChain arguments passed in? If so, it seems likely that they are not being passed correctly. Without seeing the actual code, and how it is called, it's difficult to say what is wrong.

Steve
0 Kudos
Intel_C_Intel
Employee
594 Views
NoComp and NoChain are passed in, but by checking with quick watch, the correct values have been passed in. I have included the call statements and declaration statements below,

Ciara

SUBROUTINE COMA (NoChain, Decay, Conv,   
     &   NoComp,InitTime, NoChgTran,   
     &   ChgTranTime,NoChgSou,ChgSouTime,  
     &   NoSou, NucSou, CompSou,  
     &   InpSou, InitInvFlag,NoChgInv,  
     &   ChgInvTime, NoOutTime, OutTime,  
     &   OutOption,NoOut, OutComp,Idisc  
     &   ,OutVal, Ifail,InpInitInv,  
     &   CompFrom,CompTo,   
     &   InpTranRate, SetInvToZero  
     &  ,NoSetComp,SetToZeroComp, NoOutVal,InpNoTran)  
  
      !MS$ ATTRIBUTES DLLEXPORT :: COMA  
      !MS$ ATTRIBUTES ALIAS:'_COMA':: COMA  
      !MS$ ATTRIBUTES STDCALL :: COMA  
	!MS$ ATTRIBUTES REFERENCE :: CONV, NoComp   
      !MS$ ATTRIBUTES REFERENCE :: NoChain, Decay  
	!MS$ ATTRIBUTES REFERENCE :: InitTime, NoChgTran, ChgTranTime  
	!MS$ ATTRIBUTES REFERENCE :: NoChgSou,ChgSouTime, NoSou  
      !MS$ ATTRIBUTES REFERENCE :: NucSou, CompSou,InpSou, InitInvFlag  
      !MS$ ATTRIBUTES REFERENCE :: NoChgInv,ChgInvTime, NoOutTime  
	!MS$ ATTRIBUTES REFERENCE :: OutTime  
	!MS$ ATTRIBUTES REFERENCE :: OutOption,NoOut, OutComp,Idisc  
	!MS$ ATTRIBUTES REFERENCE :: OutVal,Ifail  
	!MS$ ATTRIBUTES REFERENCE :: InpInitInv,CompFrom,CompTo  
	!MS$ ATTRIBUTES REFERENCE :: InpTranRate, SetInvToZero  
	!MS$ ATTRIBUTES REFERENCE :: NoSetComp,SetToZeroComp, NoOutVal  
	!MS$ ATTRIBUTES REFERENCE :: InpNoTran  
  
	IMPLICIT NONE  
* Declare and initialise variables  
    INTEGER(2):: Iyr, Imon, Iday, Ihr, Imin, Isec, I100th  
    INTEGER(4):: Conv, FirstOutTime, I, Ibx, Ich, Icm, Icomp, Id  
    INTEGER(4):: Idisc, Ifail, Ifind, Ineg, InitInvFlag   
	INTEGER(2):: InpNoTran  
	INTEGER(4):: Inv, Iop, Iot  
    INTEGER(4):: Irn,Iso, Isp, Itm, Itr, Jfind, Jtm, Kfind  
	INTEGER(4):: LastOutTime, LastRunTime,NoBox, NoChgInv, NoChgSou  
	INTEGER(4):: NoChgTran, NoComp, NoOut,NoChain,NoOutTime, NoOutVal   
	INTEGER(4):: NoRank, NoRun, NoRunTime, NoSetComp, NoSou,NoSpace   
	INTEGER(4):: NoTran, OutOption, SetInvToZero  
	Integer, Dimension(4*NoComp*NoChain)::BoxFrom  
    Integer, Dimension(NoChain)::BoxNoInv  
	Integer, Dimension(NoComp*NoChain)::BoxSou  
	Integer, Dimension(4*NoComp*NoChain)::BoxTo  
	Integer, Dimension(NoChgTran+1)::CompFrom  
	Integer, Dimension(NoSou)::CompSou  
	Integer, Dimension(NoChgTran+1)::CompTo  
	Integer, Dimension(3*NoChgTran+1)::FlagInv  
	Integer, Dimension(3*NoChgTran+1)::FlagTran  
	Integer, Dimension(3*NoChgTran+1)::IndInv  
	Integer, Dimension(3*NoChgTran+1)::IndSou  
	Integer, Dimension(3*NoChgTran+1)::IndTime  
	Integer, Dimension(3*NoChgTran+1)::IndOutTime  
	Integer, Dimension(3*NoChgTran+1)::IndTran  
    Integer, Dimension(NoSou)::NucSou  
	Integer, Dimension(2)::OutOpt  
    Integer, Dimension(NoComp*NoChain)::Rank  
	Integer, Dimension(NoChgTran+1*NoSetComp)::SetToZeroComp  
    Integer, Dimension(NoOut)::OutComp  
    REAL(KIND=4), Dimension(NoChgInv+1,NoComp*NoChain)::InpInitInv  
    REAL(KIND=4), Dimension(NoSou,NoChgSou+1)::InpSou  
	REAL(KIND=4), Dimension(InpNoTran,NoChain)::InpTranRate  
    REAL(KIND=8)::InitTime  
	REAL(KIND=8), Dimension(NoChgInv)::ChgInvTime  
	REAL(KIND=8), Dimension(NoChgSou)::ChgSouTime  
	REAL(KIND=8), Dimension(NoChgTran)::ChgTranTime  
	REAL(KIND=8), Dimension(NoChain)::Decay  
	REAL(KIND=8), Dimension(NoComp*NoChain)::InitInt  
    REAL(KIND=8), Dimension(NoCom
p*NoChain)::InitInv  
	REAL(KIND=8), Dimension(NoComp*NoChain,NoChgInv+1)::RINV  
	REAL(KIND=8), Dimension(NoComp*NoChain,NoChgInv+1)::RINT  
	REAL(KIND=8), Dimension(4*NoChgInv+1)::RunTime  
	REAL(KIND=8), Dimension(NoComp*NoChain)::Sou  
    REAL(KIND=8), Dimension(4*NoChgInv+1)::Times  
    REAL(KIND=8), Dimension(NoComp*NoChain*NoChain+1)::TranRate  
	REAL(KIND=8), Dimension(NoChain)::OutFac  
	REAL(KIND=8), Dimension(NoOutTime)::OutTime  
	RE
0 Kudos
Steven_L_Intel1
Employee
594 Views
I suggest you send a reproducible example, including the calling VB code, to us at vf-support@compaq.com.

Steve
0 Kudos
Reply