Article View: gnu.g++.help
Article #623Re: Has anyone made cfortran.h work with gcc?
From: Hamish Macdonald
Date: Tue, 15 Dec 1992 14:50
Date: Tue, 15 Dec 1992 14:50
29 lines
1745 bytes
1745 bytes
>>>>> On 14 Dec 1992 23:17:18 GMT,
>>>>> In message <1gj4luINNp7g@gap.caltech.edu>,
>>>>> walter@cithe501.cithep.caltech.edu (Chris Walter) wrote:
Chris> I would like to call Fortran routines from within my C++
Chris> programs. Has anyone managed to modify cfortran.h(a header
Chris> file which allows one to easily call fortran routines within C)
Chris> to work with gcc? I contacted the author and he isn't aware of
Chris> anyone who has done it. I thought this might work:
Chris> extern "C" {
Chris> #include "/users/walter/cfortran/cfortran.h"
Chris> #define RANNOR(A,B) CCALLSFSUB2(RANNOR,rannor,FLOAT,FLOAT,A,B)
Chris> }
Chris> but no luck. The linker complains it can't find
Chris> rannor__Fp(some other stuff)
Chris> so clearly the compiler doesn't know rannor is foreign....
It looks like there is no prototype for "rannor" in "cfortran.h", so
C++ is assuming "C++" linkage the first time it sees a reference to
"rannor".
For C++ to know that "rannor" has "C" linkage, a prototype for it
*must* exist in "cfortran.h".
Try adding a prototype to "cfortran.h" and see if that helps.
Technical Details
Message-ID:
<1992Dec15.145009.4699@bmerh85.bnr.ca>Path:
arc1-ca.pugleaf.net!sparky!uunet!europa.asd.contel.com!howland.reston.ans.net!usc!sdd.hp.com!swrinde!cs.utexas.edu!torn!nott!bnrgate!bmerh85!bmerh85!hamishReferences:
<1gj4luINNp7g@gap.caltech.edu>Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.help Path: arc1-ca.pugleaf.net!sparky!uunet!europa.asd.contel.com!howland.reston.ans.net!usc!sdd.hp.com!swrinde!cs.utexas.edu!torn!nott!bnrgate!bmerh85!bmerh85!hamish From: Hamish.Macdonald@x400gate.bnr.ca (Hamish Macdonald) Subject: Re: Has anyone made cfortran.h work with gcc? In-Reply-To: walter@cithe501.cithep.caltech.edu's message of 14 Dec 1992 23:17:18 GMT Message-ID: <1992Dec15.145009.4699@bmerh85.bnr.ca> Lines: 29 Sender: news@bmerh85.bnr.ca (Usenet News) Organization: Bell Northern Research References: <1gj4luINNp7g@gap.caltech.edu> Distribution: gnu Date: Tue, 15 Dec 92 14:50:09 GMT