Hi there,
If I have Modules:
!<=================================================
Module Whatever_hdr
Type stWhatever Type-Whatever :: iBovvered EndType stWhatever
End Module Whatever_hdr
!>=================================================
!<=================================================
Module Spots_hdr
!! Modules USE Whatever_hdr !! stWhatever
Type stSpots Integer*4 :: iVariable Type(stWhatever) :: pstWhatever EndType stSpots
End Module Spots_hdr
!>=================================================
!<=================================================
Module Spots
IMPLICIT NONE
Contains
!=================================================
Logical*4 Function Spots_Func(pstSpotsP)
!! Modules USE Spots_hdr !! stSpots
!! Passed Type(stSpots), INTENT(INOUT) :: pstSpotsP
!! Locals Logical*4 bNoErrorL, bEverthingOkL
bEverthingOkL = .FALSE. Do Do something with pstSpots perhaps
bEverthingOkL = .TRUE.
Exit
Enddo
Spots_Func = bEverthingOkL End Function Spots_Func
!=================================================
End Module Spots
!>=================================================
!<=================================================
Module Leopard_hdr
!! Modules USE Spots_hdr !! stSpots
Type stLeopard Integer4 :: iCount Integer4 :: iEnd Type(stSpots), Pointer :: ptrSpots EndType stLeopard
End Module Leopard_hdr
!>=================================================
!<=================================================
Module Leopard
IMPLICIT NONE
Contains
!! Modules USE Leopard_hdr !! stLeopard
!! Declarations Type(stLeopard), Private :: pstLeopardM
!=================================================
Logical*4 Function Leopard_Func1(pstSpotsP)
!! Modules USE Spots !! Spots_Func
!! Passed Type(stProject), Target :: pstSpotsP
!! Locals Logical*4 bNoErrorL, bEverthingOkL
bEverthingOkL = .FALSE. Do pstLeopardM%ptrSpots ⇒ pstSpotsP
bNoErrorL = Spots_Func(pstSpotsP) If(.NOT.bNoErrorL) Exit
bNoErrorL = Spots_Func(pstLeopardM%ptrSpots) If(.NOT.bNoErrorL) Exit
bEverthingOkL = .TRUE. Exit Enddo
Leopard_Func1 = bEverthingOkL End Function Leopard_Func1
!=================================================
!=================================================
Logical*4 Function Leopard_Func2()
!! Locals Logical*4 bNoErrorL, bEverthingOkL
bEverthingOkL = .FALSE. Do Do pstLeopardM%iCount = 1, pstLeopardM%iEnd Do something (with Exit condition), or even do nothing, makes no odds Enddo
bEverthingOkL = .TRUE.
Exit
Enddo
Leopard_Func2 = bEverthingOkL End Function Leopard_Func2
!=================================================
Subroutine Leopard_New()
pstLeopardM%iCount = -1 pstLeopardM%iEnd = -1 NULLIFY(pstLeopardM%pstSpots) End Subroutine Leopard_New
!=================================================
End Module Leopard
!>=================================================
Assuming I have the above pseudo-code correct (hope y'all get the idea) and Leopard_New has been called and all other structures etc have been initialised etc, then:
If I use (a) this gives: Error 15, Attempt to access undefined argument to routine If I use (b) then no such error occurs and carries on ...
Why is this?
In Leopard_Func2, the compiler returns: error 227 - DO control variables must be INTEGER or REAL scalar variables only error 52 - Compilation abandoned However, both iCount and iEnd are Integer4 I replaced iEnd with a local Integer4 == still get error. I replaced iCount with a local Integer*4 and it compiles with no errors.
I swapped the order of iCount and iEnd in stLeopard, but the compiler still complained about iCount. I have checked spelling, copy-Pasted the structure-name