Re: Structure of large link libraries in f95



Charles Russell <SPAMworFREEwor@xxxxxxxxxxxxx> wrote:

Is it possible to create a module from a set of library routines by
simply INCLUDEing f77 files, so as not to muck up the originals? The
following try hangs up on the gfortran requirement for "END SUBROUTINE"
where f77 has simply END.

Nope. Not strictly, at least not now. The "end subroutine" thing is
simple to fix, even automatically, but you do have to fix it, so if
touching the source at all is a no-no, or if keeping it f77-compatible
is required, then no.

There's a proposal to allow the subroutine keyword to be optional in
order to facilitate this kind of thing, but that's not even in f2003,
but the next standard after that (and thus it is still just a proposal,
though I think that one is a "shoo-in"). So that will be quite a while.
Well, I'd lay decent odds that some compilers will allow that form as an
extension before then, but quite a while until it is standardized.

You do have one other option to create a module from f77 routines. It
isn'y my favorite option in general, but it does work and there are
cases where it is the best option.

There are ways to "ease into" f90 stuff. You don't actually have to do
it as an all-or-nothing thing. That includes module issues.
Specifically...

Compile your code and put it in a library the same way you do now. Then
make a module with nothing but interface blocks. I think there are some
tools to help in automatically reading the source and making appropriate
interface blocks. I couldn't point you to those tools off the top of my
head, as I haven't had enough need to go looking, but some of the rules
for interface bodies have no other purpose but to make such tools easier
to do, so I assume someone must have done such tools. ??

You end up being able to use both the f77 ways and the newfangled module
ways of accessing the procedures.

--
Richard Maine | Good judgment comes from experience;
email: my first.last at org.domain| experience comes from bad judgment.
org: nasa, domain: gov | -- Mark Twain
.



Relevant Pages

  • Why use modules?
    ... in the 2nd example than with F77. ... becomes necessary to utilize these advanced features there is ... subroutine mysub! ... $ fort myprog.f77 ...
    (comp.lang.fortran)
  • Re: array slice
    ... Array slices were "new" to f90 (which is ... happy to not be using f77, but I'm not paying the bills... ... As for the F90 slices, when passing a row Ato a subroutine, do ...
    (comp.lang.fortran)
  • Re: Proper way to return a string
    ... fixed size but it can vary if you use a subroutine. ... the LEN of the character argument is the ... This is why TRIMcan never be implemented in F77, ... a string from a routine whose length is not known when the routine is entered. ...
    (comp.lang.fortran)
  • Re: Structure of large link libraries in f95
    ... following try hangs up on the gfortran requirement for "END SUBROUTINE" ... where f77 has simply END. ... The INCLUDE file trick is a good idea. ... Since you are worried about g77 compatibility, ...
    (comp.lang.fortran)
  • Re: equivalence with dummy arguments
    ... > END SUBROUTINE ... > I know that's illegal in f77 as well, but in practice it is giving ... no deficiencies and the other way is to make it so complicated ...
    (comp.lang.fortran)