! MAIN2.F90 Copyright(c) 1994 - 1998, Lahey Computer Systems, Inc. ! Copying for sale requires permission from Lahey Computers Systems. ! Otherwise, distribution of all or part of this file is permitted ! if these four lines are included. ! ! MAIN2.F90, This is a main program unit for use with the ! DLL2 DLL. Please refer to the MK2_50.BAT and MK2_05.BAT ! files for instruction on building this example ! ! This example demonstrates tricky interfaces between ! DLL and MAIN, using COMPLEX and CHARACTER data types PROGRAM main DLL_IMPORT DLL2 COMPLEX cx1, cx2(10) COMPLEX*16 dcx1, dcx2(10) CHARACTER*8 ch1*5, ch2(10) INTEGER result, dll2 result = dll2(cx1, cx2, dcx1, dcx2, ch1, ch2) IF(result /= 9999) STOP "failed result" IF(ABS(REAL(cx1) - 1.23) > .1) STOP "failed cx-real" IF(ABS(AIMAG(cx1) - 3.21) > .1) STOP "failed cx-imag" IF(ABS(REAL(dcx1) - 3.23) > .1) STOP "failed dcx-real" IF(ABS(DIMAG(dcx1) - 1.21) > .1) STOP "failed dcx-dimag" IF(ch1 /= "abcde") STOP "Failed ch1" DO ido=1, 10 IF((REAL(cx2(ido)) - (6.78+ido)) > .1) STOP "Failed cx2-real" IF((AIMAG(cx2(ido)) - (9.87+ido)) > .1) STOP "Failed cx2-imag" IF((REAL(dcx2(ido)) - (67.89d0+ido)) > .1) STOP "Failed dcx2-real" IF((DIMAG(dcx2(ido)) - (98.76d0+ido)) > .1) STOP "Failed dcx2-imag" DO jdo=1, 8 IF(ch2(ido)(jdo:jdo) /= CHAR(ICHAR('k') + ido + jdo)) STOP "Failed ch2" ENDDO ENDDO STOP "Passed Example 2" ! when we get this far everything is working END PROGRAM main