Silverfrost Forums

Welcome to our forums

Statement ordering error - FUNCTION cannot appear after type

10 Mar 2010 4:25 #6113

If I have the STDCALL statement below the FUNCTION I do not get the error, but if the STDCALL is above I get the following error message:

Statement ordering error - FUNCTION cannot appear after type definition statements C:\Perforce\Mv-90\Main\FORT\CommonShared\CommonShared\ITRV.F90 5

!!Interface to use Pervasive's DLL BTRCALL routine contained in WBTRV32.DLL
STDCALL BTRCALL '_BTRCALL@28' (VAL,REF,REF,REF,REF,VAL,VAL):INTEGER*4

!***********************************************************************
FUNCTION Itrv(operation,posblock,databuffer,datalength,keybuffer,keynumber)
  IMPLICIT NONE
  !Make it public
  ASSEMBLY_INTERFACE (name='Itrv')
  
  ! B_OPEN...
  INTEGER*4, INTENT(IN OUT)       :: operation
  ! RTE_FCB
  CHARACTER (LEN=128), INTENT(IN) :: posblock
  ! RTE_BUF
  CHARACTER (LEN=*), INTENT(IN)   :: databuffer
  ! RTE_LEN
  INTEGER*4, INTENT(IN)           :: datalength
  ! RTE_KEY0
  CHARACTER (LEN=*), INTENT(IN)   :: keybuffer
  ! KEY0
  INTEGER*4, INTENT(IN OUT)       :: keynumber
  ! max_key_size
 
  INTEGER*4	                     keylength 
  INTEGER*4			     btrcall,status,itrv
 
  keylength=255
  status=btrcall(operation,posblock,databuffer,datalength,keybuffer,keylength,keynumber)
  itrv=status
 
  RETURN
END FUNCTION Itrv

!Interface to use Pervasive's DLL BTRCALL routine contained in WBTRV32.DLL
!STDCALL BTRCALL '_BTRCALL@28' (VAL,REF,REF,REF,REF,VAL,VAL):INTEGER*4

I would prefer the STDCALL at the beginning of the file if possible. Any suggestions?

10 Mar 2010 6:14 #6114

The STDCALL line is like any other declaration, it must appear within a main or sub program (FUNCTION or SUBROUTINE).

Please login to reply.