Passing Variables from Microsoft FORTRAN to Basic (27477)



The information in this article applies to:

  • Microsoft Visual Basic for MS-DOS
  • Microsoft Basic Professional Development System for MS-DOS 7.0
  • Microsoft Basic Professional Development System for MS-DOS 7.1
  • Microsoft QuickBASIC 4.5

This article was previously published under Q27477

SUMMARY

Below is an example of passing variables from Microsoft FORTRAN for MSDOS, version 5.1 to Microsoft Visual Basic for MS-DOS, version 1.0. This example also works with Microsoft Quick Basic for MS-DOS, version 4.5 and Microsoft FORTRAN for MS-DOS version 4.1; and Microsoft Basic Professional Development System for MS-DOS, version 7.1 and Microsoft FORTRAN for MS-DOS, version 5.0.

MORE INFORMATION

The Basic program is as follows:
DECLARE SUB forsub ()
CALL forsub

SUB subbas (a%, b&, c!, d#)
  PRINT a%, b&, c!, d#
END SUB
				
The FORTRAN subroutine is as follows:
      *The equivalent of a Basic DECLARE statement

       INTERFACE TO SUBROUTINE SUBBAS (N1,N2,N3,N4)
       INTEGER*2 N1 [NEAR]
       INTEGER*4 N2 [NEAR]
       REAL*4 N3 [NEAR]
       REAL*8 N4 [NEAR]
       END

      *Actual subroutine that is called

       SUBROUTINE FORSUB
       INTEGER*2 A [NEAR]
       INTEGER*4 B [NEAR]
       REAL*4 C [NEAR]
       REAL*8 D [NEAR]
       A = 9
       B = 999
       C = 99.99
       D = 999.999
       CALL SUBBAS(A,B,C,D)
       END
				
The OUTPUT is as follows:
9       999        99.99        999.999
				

Modification Type:MinorLast Reviewed:8/16/2005
Keywords:KB27477