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

Problems with usage of "Interface TO" through a module

abhimodak
New Contributor I
581 Views
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
0 Kudos
4 Replies
Steven_L_Intel1
Employee
581 Views
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.
0 Kudos
abhimodak
New Contributor I
581 Views
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
0 Kudos
Steven_L_Intel1
Employee
581 Views
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


0 Kudos
abhimodak
New Contributor I
581 Views
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
0 Kudos
Reply