Re: Fortran module checking



Eigenvector wrote:
I'm a serious newbie to Fortran and am asking this because I'm being forced to help debug another unwilling person's code. Forgive the lack of understanding.

The code that I'm interested in uses modules to retrieve variable names for the main code. Essentially there is a variable.f containing all the code variables which is turned into a .mod file - that is then called by main.f with a USE statement.

It would appear through my debugger (idebug) that attempts to call code in that .mod file are returning segmentation faults. But I can't prove that and the developer is balking. So I'm looking for ways to demonstrate that the contents of the .mod file are being included in the finished product and available to the executable - that the syntax is proper. He's a developer and believes my system is in error, I'm a Sys Ad and believe his code is in error so I'm trying to establish the validity of my position by demonstrating that either I'm right or wrong.

Is it as simple as (mind you I'm using xlf90)
! variable.f psuedocode
variable1 = tag1, tag2

xlf90 variable.f -o variable.mod (I'm paraphrasing here)

! main.f psuedocode
use tag1="Hello"
use tag2="Hi"

xlf90 main.f -o program.exe

Or are there compile options that should be invoked to ensure that USE statements get included into the main code?


Probably to evaluate the code syntax it would be best to post a
reasonable amount of the code itself so it can be looked at directly. As
several other concurrent and recent threads have shown, trying to
paraphrase rather than showing exact symptoms/code is almost futile.

A minimal module and program using that module would look something like

Module my_mod
implicit none
integer :: i
real :: x
end module

program use_module
implicit none
use my_mod

i = 1
x = 123.45

write(*,*) i, x
end program

I don't know the xlf compiler so can't help much on it, but one needs then to compile the file containing the module and have it's output (the .mod file although the use of .mod isn't standard but a common choice, xlf may use something else) wherever the compiler expects to find it -- typically the same location as the source of the code which expects to USE it.

Then, compile and link the main program that USE's the module.

HTH...

--
.



Relevant Pages

  • Re: Fortran module checking
    ... Forgive the lack of understanding. ... Is it as simple as (mind you I'm using xlf90) ... Or are there compile options that should be invoked to ensure that USE statements get included into the main code? ... program compiles, it is getting access to the module. ...
    (comp.lang.fortran)
  • Re: Fortran module checking
    ... and the developer is balking. ... Is it as simple as (mind you I'm using xlf90) ... variable.f psuedocode ... Or are there compile options that should be invoked to ensure that USE ...
    (comp.lang.fortran)
  • Re: Multi-platform conditional compilation
    ... and compile with xlf90. ... Then in the compile command pass the pre- ... filename suffix). ... I know PGI, Intel, g95, gfortran support pre-processor. ...
    (comp.lang.fortran)