Path: ...!news.mixmin.net!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: baf Newsgroups: comp.lang.fortran Subject: Re: I am getting a strange error when compiling abcpar.f in gfortran Date: Mon, 11 Nov 2024 22:06:19 -0800 Lines: 69 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: individual.net 54XcuCNmonpVw+1ZGeAViwGLnKhzqLK407zvHbjyK8wmZ+99si Cancel-Lock: sha1:zvIfpOmxtYy9htEMsunKEEgYh2w= sha256:zv1rwVlkn8L1HjxkzBDhaoZ/pudXZalK6kJaLQszK/M= User-Agent: Mozilla Thunderbird Content-Language: en-US In-Reply-To: Bytes: 3119 On 11/11/2024 7:57 PM, Lynn McGuire wrote: > On 11/11/2024 4:35 PM, Lynn McGuire wrote: >> I am getting a strange error when compiling abcpar.f in gfortran: >> >> >> Compiling .\CHM\VALIEQ\abcpar.f >> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >> - - - - - >> dii.inc:30:10: >> Error: 'abcpar' of module 'aaa_modules', imported at (1), is also the >> name of the current program unit >> Error: Last command making (build\abcpar.o) returned a bad status >> Error: Make execution terminated >> * Failed * >> >> >> C     aaa_modules.f >> C  list of interfaces in a module for CHM / DII code compiling >>        MODULE aaa_modules >>            implicit none >>            INTERFACE >>              SUBROUTINE ABCPAR(ISW,IRETST,IR,IC,PAR,IPHASE) >>                INTEGER(KIND=8) :: ISW >>                INTEGER(KIND=8) :: IRETST >>                INTEGER(KIND=8) :: IR >>                INTEGER(KIND=8) :: IC >>                REAL(KIND=8) :: PAR >>                INTEGER(KIND=8) :: IPHASE >>              END SUBROUTINE ABCPAR >>            END INTERFACE >> ... >>        END MODULE aaa_modules >> >> >>        SUBROUTINE ABCPAR (ISW, IRETST, IR, IC, PAR, IPHASE) >>        INCLUDE 'dii.inc' >> ... >>        return >>        end >> >> >> C  dii.inc >>        use aaa_modules >> C        force all variables to be declared >>        implicit none >> >> >> Thanks, >> Lynn McGuire > > Apparently, the current subroutine being compiled cannot have an > interface in the module being USEd. > > The Metcalf Fortran 95 book says that I can exempt the current > subroutine from the USE by: > > USE module_name, exempt_this_one => name > > where name is the name of current subroutine or function without the > file suffix and without the path. > > I just need a way to generalize the name and __FILE__ does not work. > > Lynn > > If all of your general purpose subroutines and functions are in modules, you don't need interfaces for them (one of the advantages of modules).