New Reply

Am I using interfaces in Fortran correctly?

 
Share Thread Thread Tools
Jul23-11, 09:31 AM   #1
 

Am I using interfaces in Fortran correctly?


I'm having problems compiling files with interfaces in Fortran. My compiler is NAG Fortran Compiler Release 5.2. I get this error:

-------------------------------------
Error: subroutines.f90, line 2: USE TEST_MOD in program-unit MY_SUB imports
symbol MY_SUB
detected at TEST_MOD@<end-of-statement
---------------------------------------

This happens when I try to compile this file, called 'subroutines.f90':

Code:
subroutine my_sub (a)
  use test_mod
  real a
  print *, a
end subroutine
The mod file 'test_mod' it refers to compiles correctly, and its code is here:

Code:
module test_mod interface
  subroutine my_sub (a)
    real a
  end subroutine
end interface
end module

END
Am I using the correct code, or is something wrong here? Thanks!
PhysOrg.com
PhysOrg
science news on PhysOrg.com

>> Ants and carnivorous plants conspire for mutualistic feeding
>> Forecast for Titan: Wild weather could be ahead
>> Researchers stitch defects into the world's thinnest semiconductor
Aug17-11, 01:30 AM   #2
 
I'm not really a Fortran programmer, but it seems like you're importing a subroutine called my_sub into another one of the same name. What exactly are you trying to do?
New Reply

Tags
fortran 95, interface
Thread Tools


Similar Threads for: Am I using interfaces in Fortran correctly?
Thread Forum Replies
EM Waves and Dielectric interfaces Advanced Physics Homework 0
brain computer interfaces Academic Guidance 3
Accessing Fortran Modules within a Fortran library from Fortran Programming & Comp Sci 0
Interfaces and waves Engineering, Comp Sci, & Technology Homework 0
Interfaces Computing & Technology 4