Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Interface with Defined Type

mattsdad
Beginner
1,518 Views
In Fortran v 10.1, I would like to create a module with a defined type and declare a set of subroutine interfaces that have anargument of the declared type. I cannot "use" the module in the interface declaration, and I get an unrecognized type error if I leave it out.

MODULEX
TYPE X_t
INTEGER :: XXX
END TYPE X_t

INTERFACE
SUBROUTINE XX(Obj)
! USE X
TYPE(X_t), INTENT(INOUT) :: Obj
END SUBROUTINE
END INTERFACE

END MODULE X

How do Imake the type visible in the interface?
0 Kudos
2 Replies
OP1
New Contributor III
1,518 Views
Quoting - mattsdad
In Fortran v 10.1, I would like to create a module with a defined type and declare a set of subroutine interfaces that have anargument of the declared type. I cannot "use" the module in the interface declaration, and I get an unrecognized type error if I leave it out.

MODULEX
TYPE X_t
INTEGER :: XXX
END TYPE X_t

INTERFACE
SUBROUTINE XX(Obj)
! USE X
TYPE(X_t), INTENT(INOUT) :: Obj
END SUBROUTINE
END INTERFACE

END MODULE X

How do Imake the type visible in the interface?

I believe you should remove "USE X" and instead type: "IMPORT :: X_t". This will make the type X_t visible from within the interface block.

Hope this helps!

Olivier
0 Kudos
Steven_L_Intel1
Employee
1,518 Views
0 Kudos
Reply