- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I would like to do something like this:
SUBROUTINE MY_SUB(I,J,K,SUB)
INTEGER,INTENT(INOUT) :: I,J,K
EXTERNAL,OPTIONAL :: SUB
INTERFACE
SUBROUTINE SUB(H)
INTEGER,INTENT(IN) ::H
END SUBROUTINE SUB
END INTERFACE
... do some work here...
END SUBROUTINE MY_SUB
In other words, I want to pass an external subroutine as an optional argument. The example above will not compile in IVF 10. Is there another way to do this?
Thanks!
Olivier
SUBROUTINE MY_SUB(I,J,K,SUB)
INTEGER,INTENT(INOUT) :: I,J,K
EXTERNAL,OPTIONAL :: SUB
INTERFACE
SUBROUTINE SUB(H)
INTEGER,INTENT(IN) ::H
END SUBROUTINE SUB
END INTERFACE
... do some work here...
END SUBROUTINE MY_SUB
In other words, I want to pass an external subroutine as an optional argument. The example above will not compile in IVF 10. Is there another way to do this?
Thanks!
Olivier
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Drop the EXTERNAL - that's the real problem. You can use either EXTERNAL or INTERFACE - not both. INTERFACE is preferred.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Steve Lionel (Intel)
Drop the EXTERNAL - that's the real problem. You can use either EXTERNAL or INTERFACE - not both. INTERFACE is preferred.
Oh, I see. Thanks Steve. I also had forgotten that OPTIONAL can be used by itself (as a statement) in addition to being used as part of a type declaration statement.
This works great.
Thanks!
Olivier
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