Date: Mon, 13 Dec 1999 18:12:39 -0500 (EST) From: "Crist J. Clark" <cjc@cc942873-a.ewndsr1.nj.home.com> To: freebsd-questions@FreeBSD.ORG (FreeBSD Questions) Subject: Back to the FORTRAN Question Message-ID: <199912132312.SAA74814@cc942873-a.ewndsr1.nj.home.com>
next in thread | raw e-mail | index | archive | help
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 <stuff deleted> }; #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/<stuff deleted> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199912132312.SAA74814>