! DLL3B.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. ! ! DLL3b.F90, This DLL is for use with the MAIN3 example. ! Please refer to the MK3_FF.BAT file for instructions ! for building this example ! ! This example demonstrates tricky interfaces between ! nested DLLs and MAIN, using a derived type data type FUNCTION COMPARE(x) ! dll3a.f90 must be compiled first USE mod TYPE(foo_t)::x,y TARGET x LOGICAL COMPARE DLL_EXPORT COMPARE DLL_IMPORT FILL INTEGER fill i = FILL(y) if(i .NE. 1) stop "failed" if (x%i .NE. y%i) stop "failed1" DO jcount = 1, 10 if (x%j(jcount) .ne. y%j(jcount)) stop "failed2" ENDDO IF (ABS(x%a - y%a) .GT. 1) STOP "failed3" IF (MAXVAL(abs(x%b - y%b)) .GT. 1) STOP "failed4" IF (x%ch1 .NE. y%ch1) STOP "failed5" DO jcount = 1, 10 IF (x%ch2(jcount) .NE. y%ch2(jcount)) STOP "failed6" ENDDO IF (ABS(AIMAG(((x%c1 - y%c1)))) .GT. 1.0) STOP "failed7" if (ABS(REAL(((x%c1 - y%c1)))) .gt. 1.0) STOP "failed8" DO jcount = 1, 10 if (AIMAG((x%c2(jcount) - y%c2(jcount))) .GT. 1.0) STOP "failed9" if (REAL((x%c2(jcount) - y%c2(jcount))) .GT. 1.0) STOP "failed10" ENDDO x%foo_p => x COMPARE = .TRUE. RETURN END FUNCTION COMPARE ! line COMPARE() except for arrays of DT ! calls FILL() to get a FILLed DT and then COMPAREs the input against that FUNCTION COMPARE2(x) USE mod TYPE(foo_t)::x(10),y TARGET x LOGICAL COMPARE2 DLL_EXPORT COMPARE2 DLL_IMPORT FILL INTEGER fill i = FILL(y) IF(i .NE. 1) STOP "failed" DO icount = 1, 10 IF (x(icount)%i .NE. y%i) STOP "failed1" DO jcount = 1, 10 if (x(icount)%j(jcount) .NE. y%j(jcount)) STOP "failed2" ENDDO IF (ABS(x(icount)%a - y%a) .GT. 1) STOP "failed3" IF (MAXVAL(abs(x(icount)%b - y%b)) .GT. 1) STOP "failed4" IF (x(icount)%ch1 .NE. y%ch1) STOP "failed5" DO jcount = 1, 10 IF (x(icount)%ch2(jcount) .NE. y%ch2(jcount)) STOP "failed6" ENDDO IF (AIMAG((x(icount)%c1 - y%c1)) .GT. 1.0) STOP "failed7" IF (REAL((x(icount)%c1 - y%c1)) .GT. 1.0) STOP "failed8" DO jcount = 1, 10 IF (ABS(AIMAG((x(icount)%c2(jcount) - y%c2(jcount)))) .GT. 1.0) STOP "failed9" IF (ABS(REAL((x(icount)%c2(jcount) - y%c2(jcount)))) .GT. 1.0) STOP "failed10" ENDDO x(icount)%foo_p => x(1) ENDDO COMPARE2 = .TRUE. RETURN END FUNCTION COMPARE2