This is the mail archive of the
mailing list for the GCC project.
Re: [Fortran] where is -lfrtbegin?
- From: "Steven G. Kargl" <kargl at troutmask dot apl dot washington dot edu>
- To: Toon Moene <toon at moene dot indiv dot nluug dot nl>
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 27 May 2002 13:10:28 -0700 (PDT)
- Subject: Re: [Fortran] where is -lfrtbegin?
> > WRT to frtbegin : there is no frtbegin.c.
> > To support shared libraries, the libF77/main.c must not be linked into
> > the archive because it contains a main() entrypoint. So I compile main.c
> > but save the object as frtbegin.o and modified the g77 driver program to
> > put a frtbegin.o on the commandline if you want to link a Fortran main
> > program.
> Because I'm not well versed at shared libraries and their limitations I
> left it that way, until we discovered that you cannot link main programs
> written in other languages than Fortran with Fortran code this way.
> Hence the libfrtbegin.a library, which solves *that* problem.
> Obviously, you have evidence that including a main program in a shared
> library is not a problem - do you think I should revert the
> libfrtbegin.a thingie ?
Do not revert GCC. I have submitted a patch to FreeBSD to follow
the GCC convention of linking a libfrtbegin. I'm guessing that
either FreeBSD's run-time linker could automagically deal
with main() in libg2c or there is some name mangling with
underscores attached to main() that covered up any problems.