Dear Ake,

Most compilers I know actually use the convention:
* .f for fixed-format source code, whether it is Fortran 77, Fortran 90 or a 
more recent Fortran version. The precise language standard should be set 
through the appropriate compiler option instead.
* .F for fixed-format source code that needs to be preprocessed before 
compiling.
* .f90 for free-format source code, which by definition is Fortran 90 or more 
recent as free-form is not allowed for Fortran 77 (and which is probably the 
source of confusion).
* .F90 for free-format source code that needs to be preprocessed before 
compiling.

But in fact, the Fortran standard does not specify extensions for files at all 
and leaves every implementation free. Which is why some old DOS/Windows 
compilers used .for, to stick with the ancient 8.3 DOS file naming.

Regards,

Kurt


Op 16/02/18 07:38 heeft [email protected] namens Åke Sandgren 
<[email protected] namens [email protected]> geschreven:

    The error is not in the compilers but rather that the common block is in
    a module.
    To access it you must have a "use" clause in the main code.
    I.e.
    PROGRAM MAIN
    use INITT
    
    Then you don't even have to define the common block in main.
    
    The "EXTERNAL INITT" does nothing in this case, it just says that the
    function/subroutine initt is external, but there is no such
    function/subroutine and it isn't used either (obviously).
    
    
    I.e., the correct main_prob.f must in this case be called main_prob.f90
    (since it is F90 not F77 code or you have to explicitly tell the
    compiler that it is dealing with f90 or at least freeform fortran code)
    And should look like
    
    PROGRAM MAIN
    use initt
    
    PRINT *,'A =', IA
    PRINT *,'B =', IB
    
    END
    
    And of course initt_probe should also be called .f90 since it is F90 not
    F77 code.
    
    On 02/15/2018 10:10 PM, Balazs HAJGATO wrote:
    > Dear Easybuilders,
    > 
    > I have some problems with fortran linking. It looks that certain versions 
of fortran does not look for external block data in libraries. If one specifies 
the object file for the block data then the result is correct. 
    > 
    > It seems that gfortran <= 4.8 works correctly, but gfortran >=4.9 not 
works correctly in some cases. 
    
    -- 
    Ake Sandgren, HPC2N, Umea University, S-90187 Umea, Sweden
    Internet: [email protected]   Phone: +46 90 7866134 Fax: +46 90-580 14
    Mobile: +46 70 7716134 WWW: http://www.hpc2n.umu.se
    

Reply via email to