Using CXML from Visual Fortran

To use CXML, you need to make the CXML routines and their interfaces available to your program. When calling CXML library routines from a Fortran 95/90 program, you include the file CXML_INCLUDE.F90 as the first statement (after the statement that introduces the program unit). Use the following INCLUDE statement:

  INCLUDE 'CXML_INCLUDE.F90'

An example of the INCLUDE statement appears in the following example program.

CXML Program Example

The free-form Fortran example program below invokes the function SAXPY from the BLAS portion of the CXML Libraries. The SAXPY function computes a*x+y.

 PROGRAM example
  !
  ! This free-form example demonstrates how to call
  ! CXML routines from Visual Fortran.
  !
  ! The include file CXML_INCLUDE.F90 contains interface statements for
  ! the CXML library routines and causes the linker to search the CXML
  ! library.  It must be the first statement following the statement
  ! that introduces the program unit.
  !
   INCLUDE 'CXML_INCLUDE.F90'
   REAL(KIND=4) :: a(10)
   REAL(KIND=4) :: b(10)
   REAL(KIND=4) :: alpha
   INTEGER(KIND=4) :: n
   INTEGER(KIND=4) :: incx
   INTEGER(KIND=4) :: incy
   n = 5 ; incx = 1 ; incy = 1 ; alpha = 3.0
   DO i = 1,n
      a(i) = FLOAT(i)
      b(i) = FLOAT(2*i)
   ENDDO
   PRINT 98, (a(i),i=1,n)
   PRINT 98, (b(i),i=1,n)
98 FORMAT(' Input = ',10F7.3)
   CALL saxpy( n, alpha, a, incx, b, incy )
   PRINT 99, (b(i),I=1,n)
99  FORMAT(/,' Result = ',10F7.3)
   STOP
 END PROGRAM example