* Calling FORTRAN from cxx
@ 1996-06-13 4:00 PS Hatton
1996-06-17 4:00 ` Steve Lionel
1996-06-19 4:00 ` PS Hatton
0 siblings, 2 replies; 3+ messages in thread
From: PS Hatton @ 1996-06-13 4:00 UTC (permalink / raw)
Cc: P.S.Hatton
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.
This has been asked by one of our users, and I'm no C++ expert, so
any help would be appreciated.
--
+--------------------------------------------------------------------+
| Paul Hatton | Voice : (UK) 0121-414-3994 |
| Senior Computer Officer | Fax : (UK) 0121-414-3952 |
| Information and Computing Systems | E-mail : P.S.Hatton@bham.ac.uk |
| Information Services, Elms Road, +--------------------------------|
| The University of Birmingham, Edgbaston, Birmingham B15 2TT, UK |
+--------------------------------------------------------------------+
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Calling FORTRAN from cxx
1996-06-13 4:00 Calling FORTRAN from cxx PS Hatton
@ 1996-06-17 4:00 ` Steve Lionel
1996-06-19 4:00 ` PS Hatton
1 sibling, 0 replies; 3+ messages in thread
From: Steve Lionel @ 1996-06-17 4:00 UTC (permalink / raw)
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/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Calling FORTRAN from cxx
1996-06-13 4:00 Calling FORTRAN from cxx PS Hatton
1996-06-17 4:00 ` Steve Lionel
@ 1996-06-19 4:00 ` PS Hatton
1 sibling, 0 replies; 3+ messages in thread
From: PS Hatton @ 1996-06-19 4:00 UTC (permalink / raw)
Thanks to all who replied - the C linkage works for FORTRAN as well.
PS Hatton (P.S.Hatton@bham.ac.uk) wrote:
: 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.
: This has been asked by one of our users, and I'm no C++ expert, so
: any help would be appreciated.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1996-06-19 4:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-06-13 4:00 Calling FORTRAN from cxx PS Hatton
1996-06-17 4:00 ` Steve Lionel
1996-06-19 4:00 ` PS Hatton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox