- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi.
My environments are as follows
IVF 9.1 pro.
MS Visual studio 2005 standard edition
I met compilation error when using a module function name as a parameter of IMSL function (QDAWO).
Of course, if I changed the location of the function f(x) to external, the code runs well.
I think the answer is simple, but I cann't find solution.
Please give me some clue.
!-----sample code from IMSL manual------
[cpp]include 'link_f90_static.h'
module test_mod
USE QDAWO_INT
USE UMACH_INT
USE CONST_INT
contains
REAL FUNCTION F (X)
REAL X
REAL ALOG
INTRINSIC ALOG
IF (X .EQ. 0.) THEN
F = 0.0
ELSE
F = ALOG(X)
END IF
RETURN
END function
subroutine calc()
INTEGER IWEIGH, NOUT
REAL A, ABS, B, ERRABS, ERREST, ERROR, &
EXACT, F, OMEGA, PI, RESULT
INTRINSIC ABS
! EXTERNAL F
! Get output unit number
CALL UMACH (2, NOUT)
! Set limits of integration
A = 0.0
B = 1.0
! Weight function = sin(10.*pi*x)
IWEIGH = 2
PI = CONST('PI')
OMEGA = 10.*PI
! Set error tolerances
ERRABS = 0.0
CALL QDAWO (F, A, B, IWEIGH, OMEGA, RESULT, ERRABS=ERRABS, &
ERREST=ERREST)
! Print results
EXACT = -0.1281316
ERROR = ABS(RESULT-EXACT)
WRITE (NOUT,99999) RESULT, EXACT, ERREST, ERROR
99999 FORMAT (' Computed =', F8.3, 13X, ' Exact =', F8.3, /, /, &
' Error estimate =', 1PE10.3, 6X, 'Error =', 1PE10.3)
end subroutine
end module
program main
use test_mod
call calc
END program main
[/cpp]
!---------end smaple code-------
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You declared F as REAL inside CALC. This hid the module procedure F. Remove F from the REAL declaration in CALC (and, of course, the EXTERNAL F) and it should work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for really fast answer.
lotus

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page