From owner-freebsd-questions Mon Dec 13 15: 8:19 1999 Delivered-To: freebsd-questions@freebsd.org Received: from cc942873-a.ewndsr1.nj.home.com (cc942873-a.ewndsr1.nj.home.com [24.2.89.207]) by hub.freebsd.org (Postfix) with ESMTP id 6FF58154CE for ; Mon, 13 Dec 1999 15:08:15 -0800 (PST) (envelope-from cjc@cc942873-a.ewndsr1.nj.home.com) Received: (from cjc@localhost) by cc942873-a.ewndsr1.nj.home.com (8.9.3/8.9.3) id SAA74814 for freebsd-questions@FreeBSD.ORG; Mon, 13 Dec 1999 18:12:39 -0500 (EST) (envelope-from cjc) From: "Crist J. Clark" Message-Id: <199912132312.SAA74814@cc942873-a.ewndsr1.nj.home.com> Subject: Back to the FORTRAN Question To: freebsd-questions@FreeBSD.ORG (FreeBSD Questions) Date: Mon, 13 Dec 1999 18:12:39 -0500 (EST) Reply-To: cjclark@home.com X-Mailer: ELM [version 2.4ME+ PL54 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG My f2c FORTRAN problems are still haunting me (see thread 'FORTRAN Error Question' from November). This time, however, I think I have more of an idea what is going on. I get the following error when it comes to linking object files produced by f77, slamshk.o(.data+0x0): multiple definition of `rshock_' slaminz.o(.data+0x1e8): first defined here *** Error code 1 Stop. If I do f2c conversions and examine the C code, see that slamshk.c has the following, struct { integer fill_1[1]; real e_2; integer fill_3[158]; } rshock_ = { {0}, (float)8.314e7 }; And slaminz.c has, struct { integer fill_1[44]; real e_2[2]; integer fill_3[19]; real e_4[19]; integer fill_5[76]; } rshock_ = { {0}, (float)4., (float)1., {0}, (float)0., (float).1, ( float).2, (float).3, (float).4, (float).5, (float).6, (float).7, ( float).8, (float).9, (float)1., (float)1.25, (float)1.5, (float) 1.75, (float)2., (float)3., (float)4., (float)5., (float)6. }; Both contain the following code before these declarations, struct rshock_1_ { real }; #define rshock_1 (*(struct rshock_1_ *) &rshock_) I understand why the linker is choking on this. Both of these declarations for rshock_ have global scope. In FORTRAN, RSHOCK is a common block in a file, slamshk.cmn, COMMON/RSHOCK/ And it appears in both slamshk.f and slaminz.f via, INCLUDE 'slamshk.cmn' Lines. It seems the original authors of this FORTRAN code definately did not write it with f2c in mind. However, I assume f2c is meant to handle common blocks. How do I rearrange the code and the f77 commands to get f77 to understand how to handle common blocks as common among several files/routines? Is there an online tutorial somewhere about how to write or modify FORTRAN code to get f77/f2c to handle it correctly? Offhand I would think f77 should have to understand how to treat common blocks something like C extern's. Thanks for any help. -- Crist J. Clark cjclark@home.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message