This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: FORTRAN -- LINKING PROGRAMS
- To: Bob Kuhn <rmkuhn at yahoo dot com>
- Subject: Re: FORTRAN -- LINKING PROGRAMS
- From: tprinceusa at mindspring dot com
- Date: Mon, 25 Sep 2000 19:45:37 -0400
- Cc: gcc at gcc dot gnu dot org
Bob Kuhn <rmkuhn@yahoo.com> wrote:
> I just obtained G77 and got my first (4 line)
program to work. I have the following higher
priority questions:
1. I tried
g77 fortfile > printfile
I wanted to get my compiler error messages to go
to "printfile". It did not work (i.e. the error
messages continued to go to the screen). Is there
an easy way to get my compiler error messages to
go to a file?
2. Typically when I have used for FORTRAN in the
past and have had large programs with many
subroutines, I have precompiled some of the
programs and link edited combining precompiled
subroutines with the source code of uncompiled
subroutines. My guess is that this is easy to do
with G77 but was unable to find an example in the
documentation. Basically I need two steps:
A. How do I compile source code of a subroutine
to some kind of object code (rather than
creating an executable file)?
B. How to I link edit, combining object code from
multiple subroutines (possibly with the source
code of another subroutine) ?
If would be great if I could get a sketch of a
simple example for doing these two steps.
I have the following lower priority questions:
1. Is it easy to have a subroutine library using
procedures similar to the ones described above?
2. I have combined C and FORTRAN routines in the
past using the ABSOFT PC compiler. Do you have a
simple example showing the link edit steps for
doing this with the GNU compilers? I may which
to go either way (FORTRAN calling C or C calling
FORTRAN.)
Any help on the above matters would be greatly
appreciated.
I would appreciate a brief note acknowledging
receipt of this email.
Thanks,
Bob Kuhn
1. read the fine manual pages on redirection of errout for whichever shell you are using e.g. 'info bash' (bash is same as sh, ksh...; other commonly used shells are tcsh/csh, cmd.exe,...
2. likewise, read up on gcc/g77 options; they are much like any linux or unix compiler, e.g. 'g77 -c file1.f, file2.f,...' to make .o (object) files. 'g77 file1.o file2.f' to make executable using both compiled and source codes.
3. static libraries (libxxx.a) are made from .o using ar, so look at sample Makefiles or 'info ar'.