Developing mixed-language code with fortran-dev and g++
Rouson, Damian
rouson@sandia.gov
Thu Nov 26 11:47:00 GMT 2009
On 11/25/09 12:19 AM, "Paul Richard Thomas" <paul.richard.thomas@gmail.com>
wrote:
> Damian,
>
> You will have to develop an interface between the gfortran and the g++
> class objects. Maybe, if this sort of requirement is widespread, we
Yes, the interface development is a whole project in itself. My project is
ForTrilinos (http://trilinos.sandia.gov/packages/fortrilinos/). The
interfaces (F2003 interface bodies using iso_c_binding) are produced by the
CTrilinos project. CTrilinos stores tables of C++ objects, exports their
methods as C function prototypes (using the extern "C" construct with no
function overloading, inheritance, or polymorphism) and generates the
Fortran interface bodies. ForTrilinos wraps these with OOP F2003.
So from the Fortran side, it appears as though I'm just interoperating with
C, but the object files I'll be linking to will be produced with g++.
> should look to going the whole hog and use the g++ representation. We
> are most of the way there, I think. The only wrinkle would be the
> very thing that we are struggling with right now; typebound generic
> procedures.
I'd love to know what advantages this provides, but I'm guessing this is a
compiler implementation detail that won't affect me since anything I pass
between the two languages will conform to the C interoperability features of
F2003.
>
> I have to confess to having designed the gfortran oop from the bottom
> up, aided and abetted by some general reading. I have been put off
> from copying the g++ by my insufficient familiarity with C++ and
> difficulty in finding comprehensible g++ documentation. Maybe it is a
> good time to remedy these deficiencies :-)
>
My knowledge of C++ is like my knowledge of Spanish. When I travel in
Spanish-speaking countries, I know enough to avoid starving and to find my
hotel, but but my ability to hold a conversation is at the level of a
3-year-old.
> The development tree has g++ there, does it not? In which case, add
> it to the --enable-langauges list.
>
Thanks for pointing that out. We'll try this first. My only concern is that
we don't have a need to be on the bleeding edge of C++, so if the
development branch of g++ is unstable, it would be nice to know wheter we
can back off and compile with the latest released version of g++ while
linking to object code from the development branch of gfortran.
> Cheers
>
> Paul
>
>
More information about the Fortran
mailing list