libg2c or libf2c

Dear Colleague:

I used to compile Fortran programs on Linux. With Linux, I have to link with either libf2c.a or libg2c.a to get the programs work. What library should I use if I port those codes from Linux to Solaris with Studio?

Thank you for your help.

[274 byte] By [shizoomwanga] at [2007-11-27 11:54:23]
# 1

I don't think you will need to link with any such libraries. Just use the "f90" or "f95" command to link your program, and it will automatically link the libraries it needs.

igba at 2007-7-29 18:55:37 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 2

Normally, code compiled with g77 only required linking in libg2c if you are directly invoking 'ld', or the code is mixed with C and you are linking with 'gcc'. Normal use of any Fortran compiler is to use it to link the code, which runs the linker with all of the appropriate libraries. If you want to see what they are for Sun, you can use the '-dryrun' flag to see what libraries are getting linked in.

If you were linking in libg2c because it is code mixed with C, then there may be other issues to consider as well. For example, you might need to use the '-mt' flag if there is multi-threaded C code.

Joe_Krahna at 2007-7-29 18:55:37 > top of Java-index,Development Tools,Solaris and Linux Development Tools...