This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
gfortran -frecord-marker and linking with g++
- From: "Christian Ott" <blowingupstars at gmail dot com>
- To: gcc-help at gnu dot org
- Date: Sat, 10 Jan 2009 05:21:01 -0800
- Subject: gfortran -frecord-marker and linking with g++
Hi,
more than a months ago I ran in to the problem described
in the following. Back then, I did not get any responses on gcc-help.
I am not sure if this was because of flaws in my description of the
problem or because gcc-help is not the right place to ask the particular
questions I was asking.
Okay, so here is my problem again, please let me know what you think.
I work with a code that uses both c++ and fortran, hence I compile
with g++ (4.3.2) and gfortran (4.3.2) and link with g++ (4.3.2). For some
old unformatted fortran files, I need to use -frecord-marker=8 with gfortran.
This works beautifully when compiling and linking (a standalone code) with
gfortran. However, when wrapping a fortran routine in c++ and linking with
g++, -frecord-marker=8 is disregarded and the executable assumes the
standard record marker position.
Example code to reproduce the problem:
---- file blah.cc:
extern "C" {
void readtest_();
}
int main(){
readtest_() ;
}
--- file readtest.F90:
subroutine readtest
implicit none
integer ns,ni,nsi
open(unit=401,file="tst.dat",form='unformatted')
read(401) ns,ni,nsi
write(6,*) ns,ni,nsi
close(401)
end subroutine readtest
--------------------
File tst.dat is a standard old-fashioned unformatted binary fortran
file containing three integers.
Compilation and linking:
g++ -O0 -g -c blah.cc
gfortran -O0 -g -frecord-marker=8 -c readtest.F90
g++ -O0 -g -frecord-marker=8 -o blah blah.o readtest.o -lgfortran
-------------------------
Is this a bug, a feature, or am I doing something wrong here?
Thanks.
- Christian