Re: [OT] convert 'C' code to 'Fortran'

From: Dan Pop (Dan.Pop_at_cern.ch)
Date: 11/11/04


Date: 11 Nov 2004 15:23:15 GMT

In <2vfbalF2knu5cU1@uni-berlin.de> Michael Mair <Michael.Mair@invalid.invalid> writes:

>sam wrote:
>
>> Hi,
>> Can anyone help me find a software that can convert a code in 'C'
>> to 'Fortran77/90' automatically?
>
>This is not really on-topic.
>However, there is a slightly more topical version: Why fix something
>that is not broken?
>C modules can communicate with fortran modules.
>Now the problem is just how to fit the two together.
>Google for "mix fortran and C". It basically comes down to
>providing interfaces, creating the right headers and intelligent
>makefiles.

The real problem is that the solution is not portable. The details of
interfacing C and Fortran are highly system specific. Everything could
just work by "magic", as was the case under VAX/VMS, but many other
platforms require the C code to have inside knowledge about the workings
of the Fortran compiler and/or vice versa.

The best attempt at hiding these details was made by the cfortran.h
project: http://www-zeus.desy.de/~burow/cfortran/

IIRC, it is only the last Fortran standard that addresses the issue.

Dan

-- 
Dan Pop
DESY Zeuthen, RZ group
Email: Dan.Pop@ifh.de
           Currently looking for a job in the European Union


Relevant Pages

  • Re: Optimizing for fast floating-point numerical code
    ... is very from the initial development phase in Fortran, ... To solve a real problem on a real machine, ... about an hour, which is great, but if it took 25 hours in Lisp my ... techniques that are easily-done in Lisp. ...
    (comp.lang.lisp)
  • Re: Optimizing for fast floating-point numerical code
    ... is very from the initial development phase in Fortran, ... To solve a real problem on a real machine, ...
    (comp.lang.lisp)
  • Re: [OT] Commodore 64 BASIC (was: Interesting bug)
    ... >situation with the Fortran version Dan Pop grew up with. ... Each program unit had its own ... of the loop was executed once instead of 5 times. ...
    (comp.lang.c)
  • Re: [OT] Commodore 64 BASIC (was: Interesting bug)
    ... >>situation with the Fortran version Dan Pop grew up with. ... > of the loop was executed once instead of 5 times. ... This is a classic bug story, about which a great deal of ...
    (comp.lang.c)
  • Re: Will Fortran 2003 Solve This Problem?
    ... checking of interfaces, which in Fortran is done when compiling the USEing ... The problem with Fortran compilers as they are now is that the compiler ... > INTERFACES to MODULE A member functions (and/or TYPE definitions in MODULE ...
    (comp.lang.fortran)

Loading