Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Message-Id: <00a801c01376$eff71530$846c2b0a@saic.com> Reply-To: "Ryan B. Caveney" From: "Ryan B. Caveney" To: "Michael O'Melia" , References: Subject: Re: Linking C & Fortran Date: Thu, 31 Aug 2000 14:11:51 -0400 Organization: SAIC MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2314.1300 X-MIMEOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 ----- Original Message ----- From: Michael O'Melia To: 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 AT sourceware DOT cygnus DOT com