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

Re: Help calling C++ functions from Fortran



> From: Jessica Thomale <address@hidden>
> To: address@hidden
> Subject: Help calling C++ functions from Fortran

Hi Jessica,

> I would appreciate if you could help me with calling C++ functions from
> Fortran.  I read that the NetCDF functions for Fortran call the C++
> functions.  I am having difficulty matching the calling conventions for
> character strings for Fortran and C++ on a UNIX system.  I am using
> the f77 compiler.  
> 
> Any suggestions would be most appreciated.

The netCDF Fortran functions call the C functions rather then the C++
functions.  If any of our documentation implies that the Fortran
interface for netCDF uses the C++ interface rather than the C interface,
I'd like to know about it so I can correct the documentation.

I don't know much about how to call C++ functions from Fortran.  As far
as I know, there is no standard for a Fortran/C++ interface that vendors
follow, so any solution would be platform-specific.  I think it would be
more difficult than calling C from Fortran, which is already non-trivial
(we use a solution developed at CERN known as "cfortran.h", but it's not
entirely satisfactory).

--Russ

_____________________________________________________________________

Russ Rew                                         UCAR Unidata Program
address@hidden                     http://www.unidata.ucar.edu