Mailinglist Archive: opensuse-programming (60 mails)

< Previous Next >
Re: [suse-programming-e] C-Fortran interface
  • From: Maura Edeweiss Monville <memonvil@xxxxxxxxxxxxxxxx>
  • Date: Tue, 6 Jun 2006 16:06:16 -0500 (CDT)
  • Message-id: <Pine.GSO.4.58.0606061602450.15368@xxxxxxxxxxxxxxxxxxxxx>
Thak you. Worked examples are always welcome to understand the rules.
It's not clear if the C external struct must be embedded in that "pack"
declaration. In some other similar websites it is stated that a particular
include file must be included in the C module ... This is confusing ...

Maura


On Tue, 6 Jun 2006, Jerry Feldman wrote:

> On Tuesday 06 June 2006 4:04 pm, Maura Edeweiss Monville wrote:
> > I do not have experience of interfacing Fortran with C.. I mean
> > exchanging and sharing data between C routines and Fortran routines
> > linked together. I would appreciate some guidelines how to do that.
> >
> > Basically, assume the following common block is defined in a fortran
> > routine called "m1505.f":
> > COMMON/LEXP/DLEXP,TO,AINT
> >
> > That is the Fortran routine defined the common block named "LEXP"
> > containing the three valiables DLEXP, TO, AINT
> > Now assume that such a Fortran routine is linked to some C routines and
> > some Tcl/Tk procedures through a GNUmakefile.
> > How can I, from inside a C routine, access the content of the variable
> > AINT in the common block LEXP ?
> It's been a while since I have done some mixed code. Essentially, the
> FORTRAN Common block is roughly equivalent to the C static storage class.
> In C, you should be able to access them by name.
> In C, for instance
> extern double DLEXP;
>
> http://h21007.www2.hp.com/dspp/files/unprotected/Fortran/docs/vf-html/pg/pgwuscom.htm
>
> However, be very careful. While floating point and integer variables have
> the same format, strings, structures, and arrays are quite different.
>
> --
> Jerry Feldman <gaf@xxxxxxx>
> Boston Linux and Unix user group
> http://www.blu.org PGP key id:C5061EA9
> PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9
>
> --
> To unsubscribe, email: suse-programming-e-unsubscribe@xxxxxxxx
> For additional commands, email: suse-programming-e-help@xxxxxxxx
> Archives can be found at: http://lists.suse.com/archive/suse-programming-e
>

< Previous Next >
Follow Ups