Subject: CCL:Re: FORTRAN & C communication

From: Michel Petitjean <ptitjean.-at-.itodys.jussieu.fr>
Date: Fri, 13 Jun 2003 17:42:23 +0200 (MEST)

To: <chemistry.-at-.ccl.net>
Subject: CCL:Re: FORTRAN & C communication

Calling fortran from C:
transmit all arguments with pointers.
No problem should occur with scalar or arrays
of integers or reals (or double precision reals).

Calling C from fortran:
use built-in functions such as %val, %adr,... when
transmitting arguments, if available on your compiler.

Multi-indiced arrays are stored according varying the first
index first in fortran, and according varying first the last
index in C. 

When compiling fortran on sgi, use the -Wf,-noappend flag,
and when compiling fortran on compaq unix, use the
-assume nounderscore flag.

Owing to the time lost for maintaining non-portable applications
mixing languages, it is sometimes better to reprogramme all
in a single language.
For numerical applications and formatted i/o, I find that fortran
is quite easier than C (I know that some people do not agree).

If you encounter difficulties, ask questions on the
comp.lang.fortran newsgroup. It is read by experienced developpers.

Michel Petitjean,                     Email: petitjean.-at-.itodys.jussieu.fr
ITODYS (CNRS, UMR 7086)                      ptitjean.-at-.ccr.jussieu.fr
1 rue Guy de la Brosse                Phone: +33 (0)1 44 27 48 57
75005 Paris, France.                  FAX  : +33 (0)1 44 27 68 14
http://petitjeanmichel.free.fr/itoweb.petitjean.html
http://petitjeanmichel.free.fr/itoweb.petitjean.freeware.html

<zaldini.-at-.ufpe.br> asked:
>Dear CCLers,
>
>I would like to find some good reference ou instruction about the
>communication between program codes written in FORTRAN and C.
>Thanks in advance.
>
>Prof. Marcelo Z. Hernandes
>UFPE - Brazil