Hi all,
Thanks for so many responses. I really appreciate your time.
the author has a build batch file to do the complication and link. see below
Build batch file:
echo off
rem EDIT THE NEXT TWO LINES IF NECESSARY*****
set ED5=C:\5th_ed
set G95=C:\g95
rem *****************************************************
set FEL=%ED5%\source\library
set PATH=%G95%\bin
rem BUILD LIBRARIES**************************************
cd %FEL%\geom
del *.a *.mod
g95 -c *.f03
ar -r geomlib.a *.o
del *.o
cd %FEL%\main
del *.a *.mod
g95 -c *.f03
ar -r mainlib.a *.o
del *.o
rem *****************************************************
rem BUILD runs.exe **************************************
cd %ED5%\source
g95 runs.f03 -o runs.exe
copy runs.exe %ED5%\source\chap04
copy runs.exe %ED5%\source\chap05
copy runs.exe %ED5%\source\chap06
copy runs.exe %ED5%\source\chap07
copy runs.exe %ED5%\source\chap08
copy runs.exe %ED5%\source\chap09
copy runs.exe %ED5%\source\chap10
copy runs.exe %ED5%\source\chap11
del runs.exe
rem *****************************************************
rem BUILD run5.bat *************************************
echo echo off>>run5.bat
I was able to build the two libraries mainlib.a and geomlib.a but could not go further using
normal compiling method you saw in prevous post.
in the build batch file, the author invoke runs.f03 to link the library and run the source code.
the runs.f03 code is as follows:
runs.f03
PROGRAM run
IMPLICIT NONE
INTEGER::narg
INTEGER::nlen
INTEGER::iargc
CHARACTER(LEN=15)::progname,dataname
LOGICAL found
narg=iargc()
IF(narg.lt.1)THEN
WRITE(,)‘Please enter the base name of program file: ’
READ(,) progname
WRITE(,)‘Please enter the base name of data file: ’
READ(,) dataname
ELSEIF (narg.lt.2)THEN
CALL getarg(1,progname)
WRITE(,)‘Please enter the base name of data file: ’
READ(,) dataname
ELSE
CALL getarg(1,progname)
CALL getarg(2,dataname)
ENDIF
nlen=lnblnk(progname)
INQUIRE(file=progname(1:nlen)//’.f03’,exist=found)
IF(.not.found)THEN
WRITE(,)‘Program file not found: ‘,progname(1:nlen)//’.f03’
WRITE(,)‘Please create or check spelling.’
STOP
ENDIF
nlen=lnblnk(dataname)
INQUIRE(file=dataname(1:nlen)//’.dat’,exist=found)
IF(.not.found)THEN
WRITE(,)‘Data file not found: ‘,dataname(1:nlen)//’.dat’
WRITE(,)‘Please create or check spelling.’
STOP
ENDIF
call system('run5.bat ‘//progname//’ '//dataname)
STOP
END PROGRAM run
I am trying to do this manually with the g95 or gfortran -c with explicit library path without success.
the task is to use g95 or gfortran compilations to do what runs.f03 does. this seems elude me.
Thanks
Martin