public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Linking C & Fortran
@ 2000-08-31  9:25 Michael O'Melia
  2000-08-31 11:09 ` Ryan B. Caveney
  0 siblings, 1 reply; 2+ messages in thread
From: Michael O'Melia @ 2000-08-31  9:25 UTC (permalink / raw)
  To: cygwin

I have not gotten on this board for sometime, but still read it.  I would
like to thank the developers for doing a *great* job!

I assume it is possible to link C and FORTRAN files.  To do this requires
some knowledge of the way variables are named and how the common blocks are
to be used...How is this done with Cygwin?  A code example for a C file
calling FORTRAN and vice versa would be greatly appreciated.  Are there any
compiler flags (special) needed?

Mike


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Linking C & Fortran
  2000-08-31  9:25 Linking C & Fortran Michael O'Melia
@ 2000-08-31 11:09 ` Ryan B. Caveney
  0 siblings, 0 replies; 2+ messages in thread
From: Ryan B. Caveney @ 2000-08-31 11:09 UTC (permalink / raw)
  To: Michael O'Melia, cygwin

----- Original Message -----
From: Michael O'Melia <mike.omelia@dynetics.com>
To: <cygwin@sourceware.cygnus.com>
Sent: Thursday, August 31, 2000 12:28 PM
Subject: Linking C & Fortran

> I assume it is possible to link C and FORTRAN files.

Absolutely.  It's been a few years since I've done it, but it's quite
possible -- if you're careful.

> To do this requires some knowledge of the way variables
> are named and how the common blocks are to be used...

Also significant are argument-type conventions for functions.  In Fortran,
everything is pass-by-reference; in C, everything is pass-by-value by
default.  Another source of amusement is that Fortran strings are not
null-terminated; from the C point of view, every string argument must be
passed as *two* arguments: the string, and then its integer length.

> How is this done with Cygwin?

Same as for any other system, really.  EGCS includes g77 as well as gcc, and
the linker happily references libraries made of objects written in either
language with no special prompting.

> A code example for a C file
> calling FORTRAN and vice versa would be greatly appreciated.

Check out the source code for Octave (from your favorite GNU ftp mirror) --
it combines large amounts of C, C++ and Fortran, and builds happily under
Cygwin.

> Are there any compiler flags (special) needed?

Nope.  Have fun!


Ryan Caveney




--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2000-08-31 11:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-08-31  9:25 Linking C & Fortran Michael O'Melia
2000-08-31 11:09 ` Ryan B. Caveney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).