c Example mixed language programming, calling a MASM 6.13 assembly language
c procedure from CVF.
c Written by Harry E. Bell of Bell Software and Services
c for unlimited use and distribution.

!dec$ attributes STDCALL, ALIAS:'_INPROD_A@16' :: inprod
      interface 
	subroutine inprod (a, b, cc, n)
        real*4 a(:)
        real*4 b(:)
c Note the following is necessary if a result is desired in a scalar argument,
c In this case, with the STDCALL conventions, a and b are arrays so they are
c automatically called by reference, but cc is a 4-byte scalar so would normally
c be called by value without the following line.
!dec$ attributes REFERENCE :: cc
        real*4 cc
        integer*4 n
        end subroutine inprod
      end interface

      real*4, allocatable :: a(:)
      real*4, allocatable :: b(:)
      real*4 cc
      integer*4 n

	allocate (a(3))
	allocate (b(3))
	a(1) = 1.
      a(2) = 2.
      a(3) = 3.
      b(1) = 1.
      b(2) = 2.
      b(3) = 4.
      cc = 0.
      n = 3
      call inprod (a,b,cc,n)
c The following result should be 17.0:
      write(*,*) cc
      end
