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: blowingupstars <blowingupstars at gmail dot com>
- To: gcc-help at gnu dot org
- Date: Sun, 7 Dec 2008 22:15:58 -0800
- Subject: gfortran -frecord-marker and linking with g++
Hi,
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 Ott