This is the mail archive of the
mailing list for the GCC project.
Re: [Fortran,patch] PR 39178 - inline main()
Tobias Schlüter wrote:
> Maybe it's possible to keep an empty stub libgfortranbegin.a that
> issues a warning when linked?
Well, that will happen automatically - depending on the order:
$ gfortran test.o -lgfortranbegin
$ gfortran -lgfortranbegin test.o
test.f90:(.text+0x6d): multiple definition of `main'
I don't know how one could produce a warning at link time using an empty
stub libgfortranbegin.a. Having no libgfortranbegin.a definitely will
produce a well-visible warning (namely the error "/usr/bin/ld: cannot
> Just a short note: maybe deprecating it for now would be the best
> option, because a google codesearch reveals quite a few uses:
What exactly do you mean by "deprecating"? Does the patch deprecate it
by not linking it any more? Or do you have something else in mind?
To a certain extend I wonder whether it makes sense to defer the removal
or not. My feeling is that most coders will not notice that they have a
-lgfortranbegin in some of their files, which is now obsolete. On the
other hand, giving them some grace period is also fine.
Actually, I do not quite understand why so many people are using
"-lgfortranbegin". If they are linking, they should use "gfortran" which
does so automatically. If their main program is not a Fortran program -
well, then they don't need it.
> I also think it's worth mentionning in the release notes.
That was my plan. I was also thinking of writing a mix-language
programming section for gfortran.texi, which also documents
_gfortran_set_args, which can be quite useful. (And is already used by