Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

Derived type in interface definitions

netphilou31
New Contributor III
1,482 Views

Hi,

I have a Fortran module in which I have declared interface definitions to external procedures (located into a dll). Some of the external routines are returning a derived type object. I have added the definition of the derived type into the module, however the compiler imposes that I redefine the derived type in each interface definition. Is it a compiler bug or can you explain why I need to do so ? 

The compiler version I am using is : Intel(R) Visual Fortran Compiler XE on IA-32, version 12.1.6 Package ID: w_fcompxe_2011.12.369 with VS shell 2010.

I had already noticed the same problem with declarations like integer(HANDLE) into an interface block. The compiler is not happy until I add a use IFWIN declaration in the interface block even if one already exists in the module header. The source code is attached.

Best regards,

0 Kudos
4 Replies
Mark_Lewy
Valued Contributor I
1,482 Views

The Fortran standard specifies that interface blocks do not inherit (by default) definitions from their host, so this is not a bug.  However, Fortran 2003 adds the import statement which allow you to access host definitions in the interface body of an interface block; see help for the import statement for more details.

0 Kudos
Steven_L_Intel1
Employee
1,482 Views
0 Kudos
netphilou31
New Contributor III
1,482 Views

Thanks a lot for this advices, I will definitely try this as soon as possible.

Best regards,

0 Kudos
netphilou31
New Contributor III
1,482 Views

Steve,

Reading your blog on the "Domestic of imported?" was really a pleasure, I will try the IMPORT declaration in my chocolate Oups interface definition.

Have a nice week end.

0 Kudos
Reply