help-gplusplus
[Top][All Lists]
Advanced

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

Fortran subroutines in c++


From: Amit Bhatia
Subject: Fortran subroutines in c++
Date: Fri, 09 Jul 2004 00:42:12 -0500
User-agent: KNode/0.7.2

Hi Everyone.
 I have also posted some portion of my queries to comp.lang.c++, hence I
apologize for repitions.

 I wish to make a call to a fortran subroutine from a c++ class. I am
reading onto it from a couple of sources on the net.
 Now I have defined the following

-----util.h-----
#ifndef UTIL_H
#define UTIL_H

#include "common.h"

extern "C" 
{ 
  void __stdcall DGPADM (int ideg,int m,double t, double H,int ldh,double
wsp,double lwsp,int ipiv,int iexph,int ns,int iflag); 
}

int utility_methodA(\\arg list);
#endif

and then 

-----util.C-----
#include "util.h"
#define TINY 1.e-30
using namespace std;

int utility_methodA(\\arg list)
{return 0;}

Now I compile this code with g++ using

g++ -c -pg -O -Wno-deprecated -ansi -pedantic   -DANSI_HEADERS
-D_G_HAVE_BOOL util.C -I.

But it complains
util.h:8: syntax error before `(' token

What is wrong: I can't get it? Isn't this the way one is supposed to call
fortran subroutines?
 And then I don't know if I need to give any special commands while linking
as well: I make an archive of all *.o files using 

ar ruv libmine.a util.o (other *.o files)

and finally i link my test program using -lmine option.

tia,
amit.


reply via email to

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