- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
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?
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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