|
发表于 2005-3-30 23:15:13
|
显示全部楼层
Post by lwsy711
zhao dao le fang fa.
The second important f77 switch is the -llib option. This option is used to tell the gcc compiler to search for subroutine calls in user-supplied libraries normally not examined by gcc. Static object libraries have the naming convention libmystuff.a where the name used in the -l option is the part wedged between lib and .a. Shared libraries also begin with lib, but have an extension similar to .so.#.##.#, where the #-sign is replaced by numbers corresponding to the library version.
Including libraries when compiling a Fortran program is illustrated by the command:
$ f77 -o foobar foobar.f -lmystuff -lmorestuff
During compilation the gcc compiler will search the libmystuff.a and libmorestuff.a libraries (in that order) for any unresolved subroutine and function calls. The order of the libraries is important. Suppose each library contained an object module named gag. Any calls to gag in the program foobar.f will be resolved by the gag object module in the first library, libmystuff.a.
It is important to remember that the -l option should always follow the list of source files. By default, f77 searches the f2c (libf2c.so.0) library and the math intrinsics library m (libm.so.4) before searching libraries specified on the command line. These libraries provide system calls, Fortran I/O functions, mathematical intrinsic functions, and run-time initialization.
那怎么知道我装的函数库中有哪些程序可以调用呢?是不是要去看函数库的man?这位兄弟有没有MKL或者ACML? |
|