Re: gfortran iso c bindings - capabilities



On Mar 12, 11:24 am, Arjen Markus <arjen.mar...@xxxxxxxxxx> wrote:
On 12 mrt, 15:10, Brendan <brendandetra...@xxxxxxxxx> wrote:

I have a large api written in c which I want call from gfortran(4.3.0)
using the iso c bindings.  These bindings are fairly new and there are
not many examples on the internet, though I have heard "fortran
95/2003 explained" has a whole chapter dedicated to this topic.

Is it possible to call any c function from gfortran? The api has many
structure data types.

You may be interested in my C wrapper then - athttp://flibs.sf.net.
It is not finished yet, but it should
get a lot of the tedious stuff out of the way (it may break
on some complicated C preprocessing features though).

To return to your question:
With the ISO_C_BINDING features interfacing to C because
a lot easier (especially much less platform-dependent).
You can transfer data in structures (derived types or C structs),
but there are some intrinsic limitations - C pointers versus
Fortran pointers for instance. Not to mention Fortran
allocatables.

The last couple of weeks there were several threads related
to the subject. They provide interesting reading - especially
the article by John Reid (referenced in one of them).

Regards,

Arjen
Thanks.

Yes, I have the John Reid text. It is the only "published" text with
examples. I need the examples because I am not up to speed on fortran
90/95/2003 and do not know c. Sure I can read the relevant section of
Intel's fortran manual, but there are _no_ examples.

Most people are more interested in calling fortran from c.
.



Relevant Pages

  • Re: getting env. variables in gfortran...
    ... The standard is a relatively automatic mapping between POSIX functions and Fortran 77. ... Fortran has traditionally run on systems that aren't POSIX, so it would be hard to embed POSIX bindings in the Fortran standard. ... What might have helped is a parameterization of the interface to OS functions so implementations of the above bindings can be made robust. ...
    (comp.lang.fortran)
  • Re: When will this ng come to accept that Fortran needs to go "back to the future" ?
    ... vendors automatically support them. ... vendors may support different bindings, ... Actually, I have never understood what a Fortran (or, for that matter, any other language) binding is really supposed to mean or to bring as a contribution. ...
    (comp.lang.fortran)
  • Re: gfortran iso c bindings - capabilities
    ... using the iso c bindings. ... on some complicated C preprocessing features though). ... Fortran pointers for instance. ...
    (comp.lang.fortran)
  • Re: gfortran iso c bindings - capabilities
    ... using the iso c bindings. ... Fortran pointers for instance. ... Most people are more interested in calling fortran from c.- Tekst uit oorspronkelijk bericht niet weergeven - ...
    (comp.lang.fortran)
  • Fortran Courses in Shrivenham, Swindon UK
    ... FORTRAN PROGRAMMING COURSES ... The courses consist of short lectures outlining language ... Professor John Reid. ...
    (comp.lang.fortran)