🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

3 total messages Started by Chris Walter Mon, 14 Dec 1992 23:17
Has anyone made cfortran.h work with gcc?
#619
Author: Chris Walter
Date: Mon, 14 Dec 1992 23:17
24 lines
1238 bytes
Hello all,

I am a new user to C++ and am using gcc on a IBM RS6000 running AIX 3.2.
(gcc 2.3.2/ g++ 2.3)

I would like to call Fortran routines from within my C++ programs.
Has anyone managed to modify cfortran.h(a header file which allows
one to easily call fortran routines within C) to work with gcc?  I
contacted the author and he isn't aware of anyone who has done it.  I
thought this might work:

extern "C" {
#include "/users/walter/cfortran/cfortran.h"
#define RANNOR(A,B) CCALLSFSUB2(RANNOR,rannor,FLOAT,FLOAT,A,B)
}

but no luck. The linker complains it can't find 

rannor__Fp(some other stuff)

so clearly the compiler doesn't know rannor is foreign....

-Chris Walter
walter@cithe501.cithep.caltech.edu
Re: Has anyone made cfortran.h work with gcc?
#620
Author: Jason Merrill
Date: Mon, 14 Dec 1992 18:20
8 lines
740 bytes
You might try using the "asm labels" extension in your declarations, i.e.:

extern fortran_func () asm ("fortran_func");

See the gcc documentation for more information on this...

--
Jason Merrill					jason@jarthur.claremont.edu
Re: Has anyone made cfortran.h work with gcc?
#623
Author: Hamish Macdonald
Date: Tue, 15 Dec 1992 14:50
29 lines
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.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads