jon@hanauma (Jon Claerbout) (06/25/89)
ABSTRACT: I converted some simple scientific Fortran/Ratfor programs into C++ to see if they would look suitable for a textbook such as my last book "Imaging the Earth's Interior". I conclude C++ is about as good as ratfor. Unfortunately, mixing Fortran with C++ ranges from undocumented to impossible. BOOK REPORT I got the Lippman C++ book. It looks like a replacement for the Stroustrup book since it fully describes the new AT&T version 2.0. Pedagogically it is a big improvement too. Since both Stroustrup and Lippman describe both C and C++ I infer they mean eventually to replace C by C++ (else why the 100+ extra pages to explain C which K&R already do beautifully)? A section called "linkage to other languages" mentions C but not Fortran. PROGRAMS We couldn't link gnu C++ mains to fortran subroutines. I converted some simple fortran scientific programs to a C++ style designed to please fortran users and I posted them to comp.lang.fortran
jima@hplsla.HP.COM (Jim Adcock) (07/06/89)
>Unfortunately, mixing Fortran with C++ >ranges from undocumented to impossible. I haven't tried this but -- Iff one has a fortran compiler that uses compatible linking protocols with one's "C" compiler, and one had a C++ compiler that supports the 'extern "C" {declarations here};' construct, then one shouldn't have much problems linking in fortran routines -- I would think. The trick would be just to pretend one's fortran routines are actually C routines. If one's fortran isn't compatible with "C", then one would have to hope one day one will have a compiler that actually supports 'extern "FORTRAN" {declarations here};'