Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

How to do the same as showed in G95

Song_G_1
Beginner
567 Views

I have a source, exe program compiled by G95 used :

G95 *.f03 mainlib.a

where the mainlib.a is a compact index of a lot of subroutines and compiled as the following:

G95 -c *.f03 *.o

ar -r mainlib.a *.o

The mainlib.f03 shown as following:

MODULE main
!
INTERFACE
!
SUBROUTINE mesh(g_coord,g_num,ips)
!
!  this subroutine draw the finite element mesh
!
 IMPLICIT NONE
 REAL,INTENT(IN)::g_coord(:,:)
 INTEGER,INTENT(IN)::g_num(:,:),ips
END SUBROUTINE mesh
!
SUBROUTINE interp(k,dt,rt,rl,al,ntp)
.
.
.
END SUBROUTINE interp
!
END INTERFACE
!
END MODULE MAIN

 

I want know how to compile this exe in Intel Fortran. The mainlib.a is not a library and I do not know how to link it with other Fortran program.

0 Kudos
3 Replies
Song_G_1
Beginner
567 Views

When using

G95 -c mainlib.f03

I got two files: main.mod & mainlib.o

0 Kudos
mecej4
Honored Contributor III
567 Views

Where is the source code for the main program? Without it, you cannot build an EXE. The archive mainlib.a IS a library. It contains the object files compiled from a number of source files, and is much more than "an index". The usual suffix for a library file in Windows is ".lib". The normal convention with Intel Fortran on Windows is to use ".f90" as the suffix for free-format Fortran source files, regardless of whether the language level is Fortran 90, 95, 2003 or (partly, to the extent implemented) 2008.

0 Kudos
Song_G_1
Beginner
567 Views

Thanks. Let me try to compile these f03(need changed into f90 as you mentioned) into a new library first. Hope it worked.

0 Kudos
Reply