using fortran lib in c++



 DEVELOP > c-Plus-Plus > using fortran lib in c++

LINK TO THIS PAGE  


rating :  0   |  0


  Page 1 of 1

1

 
Topic: DEVELOP > c-Plus-Plus
User: "Pawel_Iks"
Date: 10 Aug 2007 01:34:49 PM
Object: using fortran lib in c++
Suppose I have lib.o file with fortran functions (I know their names
and the lists of them arguments). How to write c++ program, which use
one of these functions, for example I want to use fortran function
which return int value and have as arguments two double numbers, and
how to compile it be g++ for example?
.

User: "utab"

Title: Re: using fortran lib in c++ 11 Aug 2007 02:29:53 AM
On Aug 10, 8:34 pm, Pawel_Iks <pawel.labed...@gmail.com> wrote:

Suppose I have lib.o file with fortran functions (I know their names
and the lists of them arguments). How to write c++ program, which use
one of these functions, for example I want to use fortran function
which return int value and have as arguments two double numbers, and
how to compile it be g++ for example?

Of course, you have to link that library. But there are some
differences(as far as I know) between F77 and F90 concerning the IO.
I, myself, use F77 on linux. I can link Lapack and C++ for instance
with g++.
You can also check the functions in the object file by the nm command.
See man nm
Also the function names most of the time take _ character, ex: for the
F77 functin foo, you have to call it as foo_ in C++ and make proper
extern declerations. These are the things I can quickly tell. But
Take a look at these pages and the similar ones
http://www.math.utah.edu/software/c-with-fortran.html
Mixed language programming and C++and Fortran or things like that.
HTH,
Umut
.


  Page 1 of 1

1

 


Related Articles
 

NEWER

pg.1232     pg.940     pg.716     pg.544     pg.412     pg.311     pg.234     pg.175     pg.130     pg.96     pg.70     pg.50     pg.35     pg.24     pg.16     pg.10     pg.6     pg.3     pg.1

OLDER