| United States-English |
|
|
|
![]() |
Exemplar Fortran 77, Exemplar C: Exemplar C and Fortran 77 Programmer's Guide > Chapter 1 IntroductionCompiler usage |
|
The examples in this section demonstrate the use of the C and Fortran 77 compilers. The functionality and options illustrated in any example in the book apply to both the C and Fortran 77 compilers. The two C compilers are described below:
The remainder of this book refers to the cc compiler. Any cc example also applies to the c89 compiler. The cc compiler command has the form: % cc [options]files where
For example, the following command % cc prog1.c prog2.c prog3.c compiles the three files (prog1.c, prog2.c, prog3.c) and produces an executable, which is named a.out by default. In this command, % cc -o prog prog.c proc1.o cc compiles prog.c to produce the object file prog.o, then calls the linker ld to link prog.o and proc1.o with the default start-up routines and library routines. The file prog.o is deleted after linking. The -o prog causes the resulting executable file to be named prog instead of a.out. For additional information, see the cc(1) man page. The two Fortran 77 compilers are described below:
The remainder of this book refers to the f77 compiler. Any f77 example also applies to the fort77 compiler. The f77 compiler command has the form: % f77 [options]files where
For example, the command % f77 -c prog.f compiles the file prog.f to produce the object file prog.o, then (because of the -c option) suppresses linking. The prog.o file can be linked later by including it on a f77 command line or by using the linker (ld) directly. In the following example, % f77 -v prog1.f prog2.f the verbose mode is enabled by using -v. When compiling in verbose mode, the compiler displays (to standard error) a step-by-step description of the compilation process. This command % f77 +O3 +Oparallel prog.f shows the request of level 3 optimizations (+O3) and the request that the compiler honor the parallelism directives of the Exemplar programming model and generate parallel code where appropriate (+Oparallel). The +Oparallel option is only valid at +O3 and above. For additional information, see the f77(1) man page. |
||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||