MORE INFORMATION
The run-time error message "F2729 I/O item illegal in namelist I/O" is
reported if you try to use far pointers while compiling in the
medium memory model.
Example 1 below demonstrates a program that performs correctly when
near parameters are used and the FORTRAN subroutine is compiled using
the medium model (FL /AM) option. The parameters are passed
incorrectly when the FORTRAN subroutine in Example 1 is compiled with
the large model (FL /AL) option.
Example 2 is the equivalent program using the far option. Example 2
performs correctly when the FORTRAN subroutine is compiled with the
large model option.
The following is Example 1, which uses the medium memory model:
Compile in Basic as follows: BC basprog/o;
Compile in FORTRAN as follows: fl /AM /APi /c forsub.for
Link as follows: LINK basprog forsub/noe;
The following Basic program is BASPROG.BAS:
DECLARE FUNCTION MAKEIT$(S$,SIZE%)
DECLARE SUB DUM1(BYVAL S1%, BYVAL S2%, BYVAL S3%, BYVAL S4%)
DIM NAM%(3000)
COMMON /NMALLOC/ NAM%()
STR1$ = MAKEIT ("TEST OF PARAMETER VALUE PASSING" ,44)
STR2$ = MAKEIT ( "STRING 2" ,43)
STR3$ = MAKEIT ("STRING 3", 14)
STR4$ = MAKEIT ("STRING 4" ,14)
CALL DUM1(SADD(STR1$), SADD(STR2$), SADD(STR3$), SADD(STR4$))
END
FUNCTION MAKEIT$ (S$,SIZE%)
MAKEIT$ = LEFT$(S$+STRING$(80, 32),SIZE%)
END FUNCTION
The following FORTRAN program is FORSUB.FOR:
SUBROUTINE DUM1(STR1, STR2, STR3, STR4)
CHARACTER*14 STR3, STR4 [NEAR]
CHARACTER*43 STR1 [NEAR]
CHARACTER*44 STR2 [NEAR]
WRITE (*,*) STR1, STR2, STR3, STR4
END
The following is Example 2, which uses the large memory model:
Compile in Basic as follows: BC basprog/o;
Compile in FORTRAN as follows: fl /AL /FPi /c forsub.for
Link as follows: LINK basprog forsub/noe;
The following Basic program is BASPROG.BAS:
DECLARE FUNCTION MAKEIT$(S$,SIZE%)
DECLARE SUB DUM1(BYVAL S1%, BYVAL S2%, BYVAL S3%, BYVAL S4%,_
BYVAL S5%, BYVAL S6%, BYVAL S7%, BYVAL S8%)
DIM NAM%(3000)
COMMON /NMALLOC/ NAM%()
STR1$ = MAKEIT ("TEST OF PARAMETER VALUE PASSING" ,44)
STR2$ = MAKEIT ( "STRING 2" ,43)
STR3$ = MAKEIT ("STRING 3", 14)
STR4$ = MAKEIT ("STRING 4", 14)
CLS
LOCATE 10,1
CALL DUM1(VARSEG(STR1$),SADD(STR1$), VARSEG(STR2$),SADD(STR2$),_
VARSEG(STR3$), SADD(STR3$), VARSEG(STR4$), SADD(STR4$) )
LOCATE 24,1
END
FUNCTION MAKEIT$ (S$,SIZE%)
MAKEIT$ = LEFT$(S$+STRING$(80, 32),SIZE%)
END FUNCTION
The following FORTRAN program is FORSUB.FOR:
SUBROUTINE DUM1(STR1, STR2, STR3, STR4)
CHARACTER*14 STR3, STR4 [FAR]
CHARACTER*43 STR1 [FAR]
CHARACTER*44 STR2 [FAR]
WRITE (*,*) STR1, STR2, STR3, STR4
END