Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: lionel@quark.zko.dec.com (Steve Lionel)
Subject: Re: Calling FORTRAN from cxx
Date: 1996/06/17	[thread overview]
Message-ID: <4q4elq$174@zk2nws.zko.dec.com> (raw)
In-Reply-To: 31C01EAC.41C6@bham.ac.uk



In article <31C01EAC.41C6@bham.ac.uk>, PS Hatton <P.S.Hatton@bham.ac.uk> writes:
|>Is it possible to call a FORTRAN (77 or 90) routine from cxx? Section
|>2.3.13 of 'Using DEC C++ for DEC OSF/1 Systems' says that
|>
|>'Specifying linkage other than "C++" or "C" generates a compile-
|>time error' (which it does)
|>
|>which would imply not, and not specifying anything on the extern
|>statement in the calling C++ code generates a linker error. Calling
|>FORTRAN from C, as per the Fortran manuals, works fine.

Use the "C" linkage and make sure you declare the arguments so that they are
passed by reference and not value.  The routine name should be downcased
and have an underscore appended to it, so if the Fortran routine is named
FOO, in C++ declare it as foo_.
-- 

Steve Lionel                      mailto:lionel@quark.zko.dec.com
Fortran Development               http://www.digital.com/info/slionel.html
Digital Equipment Corporation     
110 Spit Brook Road, ZKO2-3/N30    
Nashua, NH 03062-2698             "Free advice is worth every cent"

For information on Digital Fortran, see http://www.digital.com/info/hpc/fortran/



  reply	other threads:[~1996-06-17  4:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-06-13  4:00 Calling FORTRAN from cxx PS Hatton
1996-06-17  4:00 ` Steve Lionel [this message]
1996-06-19  4:00 ` PS Hatton
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox