Problem to call a Fortran subroutine in C++

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

 



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 of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux