LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1013|回复: 9

求助 关于lib的调用

[复制链接]
发表于 2005-3-29 20:47:40 | 显示全部楼层 |阅读模式
我是一个刚开始用linux编程的新手,需要在linux下进行科学计算,在用fortran写程序。遇到了一个问题。我安装了一个软件(paw),可是在写fortran程序的时候不知道该怎么调用lib。就是用f77编译时老是找不到所需调用的函数。
我把这个软件安装在了‘/cern/2004/’ 后来把‘/cern/2004/lib’ 里的内容拷到‘/lib‘下。还是不行。
希望各位大侠能告知解决方法。谢了谢了     :thank  :thank
 楼主| 发表于 2005-3-29 21:50:33 | 显示全部楼层
ding
回复 支持 反对

使用道具 举报

发表于 2005-3-30 11:12:50 | 显示全部楼层
我机器里面还装了MKL,ACML,就是不知道如何在fortran程序里面调用。比如我想用随便哪个库里面的函数解我的一个线性方程组,该怎么办?程序里面不知道那个解线性方程组的命令是什么。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-3-30 12:52:28 | 显示全部楼层
呵呵,问题多了一个,没人来解答啊....
回复 支持 反对

使用道具 举报

发表于 2005-3-30 13:36:28 | 显示全部楼层
我知道fortran的函数库是非常厉害的,但是没有人教过是怎么在程序中调用的。在编译中我可能知道一点。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-3-30 20:34:08 | 显示全部楼层
me too....
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-3-30 21:20:21 | 显示全部楼层
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.
回复 支持 反对

使用道具 举报

发表于 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?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-4-1 08:51:18 | 显示全部楼层
那好象就得看程序带的库函数说明了。
顺便问一下,mkl是什么?
回复 支持 反对

使用道具 举报

发表于 2005-4-1 23:11:03 | 显示全部楼层
Intel的Math Kernel library
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表