- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I encounter a problem when I try to compile a source code with the following module with two compilers in visual studio 2010: the Intel visual fortran compiler would show a runtime error saying that "error#8169: The specified interface is not declared. [FUNCTION_TEMPLATE] at line 15," while the Portland visual fortran compiler could run it without issuing any warning. Can anyone help me out with figuring out anything wrong?
Thanks, Li
PS. I use this somewhat complicated declaration to implement the Broyden algorithm solving equations system of arbitrary size conditional on the real problem. There are two function types declared in the abstract interface area: The first one is just for describing the equation system of interest; The second one describes the penalty function used for the squared error minimization in the Broyden algorithm.
01 MODULE toolbox
02 IMPLICIT NONE
03 ABSTRACT INTERFACE
04 FUNCTION function_template(x) RESULT(y)
05 IMPLICIT NONE
06 REAL, DIMENSION(:) :: x
07 REAL, DIMENSION(SIZE(x)) :: y
08 END FUNCTION function_template
09
10 FUNCTION penalty_template(x,fvec_p,proc_p) RESULT(y)
11 IMPLICIT NONE
12 REAL, DIMENSION(:) :: x
13 REAL, DIMENSION(:), POINTER :: fvec_p
14 REAL :: y
15 PROCEDURE(function_template), POINTER :: proc_p
16 END FUNCTION penalty_template
17 END INTERFACE
18 CONTAINS
19 ...
20 END MODULE toolbox
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Since you showed only a paraphrase of the code, the following is a guess: in order to use entities defined in the module in an interface, you may need an IMPORT statement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The code posted is sufficient to illustrate the problem, though it would have been easier if the line numbers were not included.
mecej4 is correct - inside an interface, no host-associated names are visible by default. You indeed need to add IMPORT following the FUNCTION line in order to make the other interface visible. I discuss this issue in Domestic or Imported? PGI Fortran has a bug here, or perhaps an extension to the standard that I would not think advisable.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page