This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Problem to call a Fortran subroutine in C++


I've trying to call a Fortran subroutine in a C++ code.

Below you can see the declaration of the subroutine and the part of C++ code that call it.


extern "C" {
extern void F_(int *n, double *tn, double *y, double *ftem, double *rpar, int *ipar);
}


// Jacobian
void jacobian(double **Jac, double *savf, double *y, double dt, int n)
{
int i,j;
double *ftem = malloc_vector(n); // Vetor com Reaction Mapping Perturbado double *rpar = malloc_vector(n); // Vetor de trabalho double
int *ipar = malloc_ivector(n); // Vetor de trabalho inteiro
double *EWT = vector_ewt(y,n); // Error Weight Vector
double u = uround(); // Roundoff
double R, R0, FAC, tn;
FAC = vector_wnorm(savf,EWT,n);
R0 = 1000*fabs(dt)*u*FAC*(double)n;
if( R0 == 0.0)
R0 = 1.0;


for(i = 0; i < n; i++)
{
R = max(sqrt(u)*fabs(y[i]),R0/EWT[i]); // Perturbação
y[i] += R; // Perturbando o vetor composicao
F_(&n,&tn,y,ftem,rpar,ipar); // Preenche o ftem com o Reaction Mapping perturbado
FAC = 1.0/R;
for(j = 0; j < n; j++)
Jac[i][j] = (ftem[j]-savf[j])*FAC;
} }



Whem I try to link both languages the compiler returns the following error message: undefined reference to 'F_'


I did all procedures described in : http://www.physics.utah.edu/~detar/phycs6720/handouts/fortran_binding.html

Anybody can help me?

Thanks.

Americo Junior


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]