bug-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fwd: call fortran subroutines from C++]


From: Francisco D'Anconia
Subject: [Fwd: call fortran subroutines from C++]
Date: Mon, 09 Apr 2001 05:58:48 GMT

--- Begin Message --- Subject: call fortran subroutines from C++ Date: Sun, 08 Apr 2001 17:19:47 -0400
I'm trying to use a fortran subroutine in my c++ code, actually porting
it to c++ would be prohibitive for performance reasons. I'm using
EGCS-1.1.2. on a Linux i386 box, and do the following:

address@hidden lseos]$ g++ -c vulcan10.cc
address@hidden lseos]$ g77 -c latsweeos.f lseos_v2.7.f
address@hidden lseos]$ g++ vulcan10.o lseos_v2.7.o -lg2c latsweeos.o
-lg2c
vulcan10.o: In function `star::evolve(void)':
vulcan10.o(.text+0xa82): undefined reference to `LSE_(double &, double
&, double &, double &, double &, double &, double &, double &, double &,
double &, double &)'
vulcan10.o: In function `star::init2(void)':
vulcan10.o(.text+0x1c8b): undefined reference to `LSE_(double &, double
&, double &, double &, double &, double &, double &, double &, double &,
double &, double &)'
vulcan10.o: In function `star::merge(int, int)':
vulcan10.o(.text+0x2d3a): undefined reference to `LSE_(double &, double
&, double &, double &, double &, double &, double &, double &, double &,
double &, double &)'
collect2: ld returned 1 exit status

      , yielding the error messages shown. I'm doing what I'm supposed
to (so I hoped),
extern "C" void LSE_(double & , double & ,double & ,double & ,double &
,double & ,double & ,double & ,double & ,double & ,double & );

      in the global declarations, and LSE_(double & , double & ,double &
,double & ,double & ,double & ,double & ,double & ,double & ,double &
,double & );

to call the fortran-subroutine:

      SUBROUTINE LSE(P,ro,ei,TE,Y_e,Pro,Pei,epo,eno,n_n,npe)

.... I also experimented with various header files, among others
"fortran.h":

#include "fortran.h"

double FORTRAN_NAME(LSE) (double & , double & ,double & ,double &
,double & ,double & ,double & ,double & ,double & ,double & ,double & );

(and within the prog):

    FORTRAN_NAME(LSE)(P, rho, eint, T, Y_e, dPdrho, dPdeint, etapo,
etano, n_nuclei, n_p_ext);

, without luck. Any hints as to what I'm doing wrong?

Attachment: danconia.vcf
Description: Card for Francisco D'Anconia


--- End Message ---

Attachment: danconia.vcf
Description: Card for Francisco D'Anconia


reply via email to

[Prev in Thread] Current Thread [Next in Thread]