- The following program fragment calls the routine SUBA in testsub.dll
- The file testsub.dll is on the PATH
- You could read the name of the dll and the name of the routine
- It feels odd to put "" around the name of the routine!
- As sum_1d_array is associated with the pointer q, it can refer to almost anything!
program call sum_1d_array_in_testsub_dll
! ...
integer :: p
pointer :: (q, sum_1d_array) ! this is non-standard
! (but a common extension)
integer :: n
real, dimension(100) :: array
real :: total
! ...
p = loadlibrary ("testsub.dll"C) ! the C at the end says -
! add a null byte as in C
q = getprocaddress (p, "SUM_1D_ARRAY"C)
call sum_1d_array (n, array, total)
!
end