This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

module with interface block


Hi,

When I try to link a program (test-ifce-f95) using a module (m_foo_ifce) 
with an interface block (example attached and explained below)
for the subroutine foo, I get this error:

:!make test-ifce-f95 2>&1| tee /tmp/v755808/32                
/usr/local/gcc-ssa/bin/gfortran  -c m_foo_ifce.f90
/usr/local/gcc-ssa/bin/gfortran  -c foo.f90
/usr/local/gcc-ssa/bin/gfortran  -c test-ifce-f95.f90
/usr/local/gcc-ssa/bin/gfortran m_foo_ifce.o foo.o test-ifce-f95.o -o test-ifce-f95
test-ifce-f95.o(.text+0x20): In function `MAIN__':
: undefined reference to `__m_foo_ifce__foo'
collect2: ld returned 1 exit status
make: *** [test-ifce-f95] Error 1


Am I doing something wrong? Or are modules with interface block for 
non-"contain"ed procedures not yet implemented? If yes, is there a known 
workaround apart from copying the procedures in the module source file and 
using the "contains" keyword?

Thank you for your useful work. I may add, that apart from this, my 
fluid mechanics direct simulation code compiles fine: it is a mixture of
f77 and f90 source code. It looks like interface blocks are the last obstacle
to obtain an executable.

The example consists of two programs:
test-f95.f90 and test-ifce.f90
both call procedure foo

test-f95.f90 uses m_foo.f90 which is a module with a contained
foo subroutine

test-ifce-f95.f90 uses m_foo_ifce.f90 which is a module with just 
the interface to foo. foo being in the file foo.f90

The makefile contains the default target that will make the two targets
test-f95 and test-ifce-f95. You need to change the F95 variable. I tested
against VAST f90 compiler and Intel Fortran Compiler.

-- 
Melvin Hadasht




Attachment: module-ifce.tar.gz
Description: GNU Zip compressed data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]