Article View: comp.lang.fortran
Article #4630Re: How to link Fortran with c++ ??
From: M. Ghassempoory
Date: Fri, 02 Feb 1996 12:42
Date: Fri, 02 Feb 1996 12:42
23 lines
1737 bytes
1737 bytes
In article <3110887E.41C6@imacsg1.epfl.ch>, Niels@imacsg1.epfl.ch says...
>
>As understand it, this is the way to go if you want to call fortran routines
>in a c++ code. But what if you want to do go the other way around ?
>
>So how do I call an data member from a c++ class in fortran ?
>say I want to call a member function called GetData() in fortran so
>how do I transplate Class->GetData() in fortran ?
>
This is rather more difficult. To my knowlegde there are no standard
methods for C++ call handling. So if your get this working by some trick
you may fail to make it work on any other machine. You could write a small C++
jacket which accepts opject A by reference and calls A.GetData() and call this
jacket from fortran:
CALL GET_DATA_JACKET(OBJ, DATA)
However the C++ compiler mangles the names of routines. So your GET_DAT_JACKET
symbol would not be resolved unless you have a look at the map files for the
true name (Something like GET_DATA_JACKETaB_12_876YFgDR... ) and use that name
in fortran. Some compilers like GCC will let you define the true name by
__asm__ directive. It is all very tricky and messy and not worth it at all.
Technical Details
Message-ID:
<DM5FB9.4vK@cf.ac.uk>Path:
arc1-ca.pugleaf.net!thor.cf.ac.uk!newsReferences:
<310DD74F.59E2@imacsg1.epfl.ch> <4env5h$3ai@nms.telepost.no> <3110887E.41C6@imacsg1.epfl.ch>Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.fortran,comp.lang.c++ Path: arc1-ca.pugleaf.net!thor.cf.ac.uk!news From: ghassempoory@cf.ac.uk (M. Ghassempoory) Subject: Re: How to link Fortran with c++ ?? Sender: news@cf.ac.uk (USENET News System) Message-ID: <DM5FB9.4vK@cf.ac.uk> Date: Fri, 2 Feb 1996 12:42:45 GMT X-Nntp-Posting-Host: giap.elsy.cf.ac.uk Content-Type: Text/Plain; charset=US-ASCII References: <310DD74F.59E2@imacsg1.epfl.ch> <4env5h$3ai@nms.telepost.no> <3110887E.41C6@imacsg1.epfl.ch> Mime-Version: 1.0 Organization: ENGIN - UWCC X-Newsreader: WinVN 0.99.7