Re: [ROOT] How to link fortran and c++

From: Andre Holzner (Andre.Holzner@cern.ch)
Date: Wed Apr 04 2001 - 17:45:31 MEST


Hi,

Brett Viren wrote:
> 
> Besides the suggestion to make sure the fortran code actually takes
> REAL*8 instead of just REAL, I think your declaration and calling is
> wrong.  Fortran ``passes by reference'' but this really means ``passes
> by pointer''.  

On the other hand, also in C++, technically, `passing by reference'
is usually implemented as `passing a pointer'.

I've been happily using things like

extern "C"
{
  void hropen_(const int &lun, const char *chtop, const char *chfile,
const
          char *chopt, int &lrec, int &istat, const int chtop_len,
          const int chfile_len, const int chopt_len);
}

on AIX and Linux/i386 for the last few years.

best regards,

André



-- 
------------------+----------------------------------
Andre Holzner     | +41 22 76 76750 
Bureau 32 2-C13   | Building 32     
CERN              | Office 2-C13    
CH-1211 Geneve 23 | http://wwweth.cern.ch/~holzner/



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:41 MET