🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.cray
Article #5

Re: Mixing FORTRAN and C under UNICOS

#5
From: Russel Shermer (R43)
Date: Wed, 28 Oct 1992 20:51
33 lines
2072 bytes
In article <1chjphINN6hc@network.ucsd.edu>, spl@alex.ucsd.edu (Steve Lamont) writes:
|> In article <1chg8hINN62d@agate.berkeley.edu> ilan343@violet.berkeley.edu (Geraldo Veiga) writes:
|> >How do I call FORTRAN subroutines from a C program under UNICOS?
|> 
|> Easy.  Just call the FORTRAN routine with its name capitalized.
|> Here's a quick test I just tried:
...
|> 
|> sn1615:/u/spl/tmp> cf77 -c foo.f
|> sn1615:/u/spl/tmp> cc -o bar bar.c foo.o
|> sn1615:/u/spl/tmp> bar
|> x = 2.000000

One other point that might save you a bit of time and frustration:

For larger  programs you might want to link with cf77 rather than cc.
In C you explicitly link against everything except libc.a.  In fortran
there is a rather large list of libraries that get linked automatically.  
If you link with cc you must specify the needed fortran libraries and get 
the order correct.  cf77 pulls in the needed fortran libraries implicitly.  
You merely add -lc after the other C libraries you specify.

	---Russ


-------------------------(Feel free to cut here)-------------------------------
Nothing I say should be misconstrued as having something to do with anything.

Email: russ@chaos.nswc.navy.mil                 Russ Shermer
Phone: (301) 394-1560                           NSWC Code R43
Fax: (301) 394-3018                             10903 New Hampshire Ave.
Office: 1-013B                                  Silver Spring, MD  20903-5000
--------------------------------------------------------------------------------
Technical Details
Message-ID: <1992Oct28.205109.1631@relay.nswc.navy.mil>
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!sgiblab!darwin.sura.net!dtix!relay!diamond.nswc.navy.mil!rsherme
References: <1chg8hINN62d@agate.berkeley.edu> <1chjphINN6hc@network.ucsd.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!sgiblab!darwin.sura.net!dtix!relay!diamond.nswc.navy.mil!rsherme
From: rsherme@diamond.nswc.navy.mil (Russel Shermer (R43))
Newsgroups: comp.unix.cray
Subject: Re: Mixing FORTRAN and C under UNICOS
Message-ID: <1992Oct28.205109.1631@relay.nswc.navy.mil>
Date: 28 Oct 92 20:51:09 GMT
References: <1chg8hINN62d@agate.berkeley.edu> <1chjphINN6hc@network.ucsd.edu>
Sender: news@relay.nswc.navy.mil
Distribution: inet
Organization: NAVSWC DD White Oak Det.
Lines: 33