- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am having trouble compiling a modules that uses an include file which contains interfaces to fortran subroutine for C.
However, if I use it through a program or a subroutine that is not in module it works. I believe there is no problem with use of include files in module but the problem is with "Interface TO".
The error recieved is "END statement confusion." This happens with 11.1.035 and 10.1.024 as well as the intermediate versions. I am using WinXP64 with VS2005.
Example is below.
Abhi
----
Module Test_InterfaceTO
Implicit None
Integer :: i
Contains
Subroutine Dummy(m)
Implicit None
Integer, Intent(IN) :: m
! Using it through module does not work?
Include "test.inc"
End Subroutine Dummy
End Module Test_InterfaceTO
=====
Program Test
Use Test_InterfaceTO
! Uncommenting the following and commenting out use in the moduel works
! Include "test.inc"
print *, "Om!"
End Program Test
=======
The contents of the include file 'test.inc':
INTERFACE TO SUBROUTINE SOMEMETHOD &
& (PS,PM)
INTEGER PS [REFERENCE]
INTEGER PM [REFERENCE]
END
However, if I use it through a program or a subroutine that is not in module it works. I believe there is no problem with use of include files in module but the problem is with "Interface TO".
The error recieved is "END statement confusion." This happens with 11.1.035 and 10.1.024 as well as the intermediate versions. I am using WinXP64 with VS2005.
Example is below.
Abhi
----
Module Test_InterfaceTO
Implicit None
Integer :: i
Contains
Subroutine Dummy(m)
Implicit None
Integer, Intent(IN) :: m
! Using it through module does not work?
Include "test.inc"
End Subroutine Dummy
End Module Test_InterfaceTO
=====
Program Test
Use Test_InterfaceTO
! Uncommenting the following and commenting out use in the moduel works
! Include "test.inc"
print *, "Om!"
End Program Test
=======
The contents of the include file 'test.inc':
INTERFACE TO SUBROUTINE SOMEMETHOD
& (PS,PM)
INTEGER PS [REFERENCE]
INTEGER PM [REFERENCE]
END
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Interesting. May I respectfully suggest that you stop using Microsoft Fortran PowerStation syntax and use standard Fortran features for this? I will ask the developers to look at this, but the priority will be low.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Steve
I will pass on your "respectful suggestion" to appropriate people....As of now I am stuck with it. :(
As I understand from "them" this is not required on Linux but is required on Windows. Is that true? What I mean is the if explicit interface through C binding is a "requirement", how come it is not required on Linux? (For building on Linux, the include file is kept empty.)
On Linux we use Intel compilers for for both C++ and Fortran; whereas on Windows we use Visual Studio C++ and Intel Fortran. Can that ne the reason for non-requirement on Linux side. In both cases, /iface:cvf is used for calling conventions.
Abhi
I will pass on your "respectful suggestion" to appropriate people....As of now I am stuck with it. :(
As I understand from "them" this is not required on Linux but is required on Windows. Is that true? What I mean is the if explicit interface through C binding is a "requirement", how come it is not required on Linux? (For building on Linux, the include file is kept empty.)
On Linux we use Intel compilers for for both C++ and Fortran; whereas on Windows we use Visual Studio C++ and Intel Fortran. Can that ne the reason for non-requirement on Linux side. In both cases, /iface:cvf is used for calling conventions.
Abhi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Well, yes, on Windows /iface:CVF would require you to do something to override the CVF conventions. On Linux, I'm not sure that option is even supported.
In any event, you could replace the INCLUDE file with this:
INTERFACE
SUBROUTINE SOMEMETHOD (PS,PM) BIND(C)
INTEGER PS
INTEGER PM
END SUBROUTINE SOMEMETHOD
END INTERFACE
In any event, you could replace the INCLUDE file with this:
INTERFACE
SUBROUTINE SOMEMETHOD (PS,PM) BIND(C)
INTEGER PS
INTEGER PM
END SUBROUTINE SOMEMETHOD
END INTERFACE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Steve
Thanks. I had tried to establish the use of standard (and up-to-date) Fortran to the relevant people before and this will help it further. The use iso-C bindings is clearly the way here and I hope I can push it through.
Abhi
Thanks. I had tried to establish the use of standard (and up-to-date) Fortran to the relevant people before and this will help it further. The use iso-C bindings is clearly the way here and I hope I can push it through.
Abhi

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