Just to add my 2 cents to this. This past year a collaborator of mine updated his F95 code to F2003 and the ISO_C_BINDING syntax and this made the interaction between our C/C++ codes and their Fortran codes extremely easy. No more macros to try to figure out. It oddly, just seems to work. Well worth our time investment.
--
Mike Jackson  [mike.jack...@bluequartz.net]

Joachim Pouderoux wrote:
Alan,

Thanks for the advice, I think you are absolutely right, we should update
to Fortran2003 to allow use of iso_c_binding module.
Anyway I have actually been able to make CMake FortranCInterface work using
a more recent version of CMake.

Best,
Joachim


*Joachim Pouderoux*, PhD

    /Technical Expert - Scientific Computing Team/
    *Kitware SAS <http://www.kitware.fr>*


2016-11-17 15:21 GMT-04:00 Alan W. Irwin <ir...@beluga.phys.uvic.ca
<mailto:ir...@beluga.phys.uvic.ca>>:

    On 2016-11-17 11:12-0400 Joachim Pouderoux wrote:

        Unfortunately I can't (Fortran95 only), that's why CMake feature is
        important.


    Hi Joachim:

    I have helped convert two projects (PLplot and the ephcom subproject
    of timeephem) recently to use the iso_c_binding module provided by
    Fortran 2003, and that approach (at least for providing a Fortran
    binding to a C library since we have had no need for a C binding to a
    Fortran library) is absolutely great and works fine with fairly recent
    versions of the Intel compiler, the gfortran compiler, and likely most
    importantly from our point of view, the NAG compiler (which advertises
    itself as being the Fortran compiler that is most demanding concerning
    compliance with Fortran standards).

    So my advice is to go ahead and at least experimentally provide the
    option of using the iso_c_binding module to future-proof your work,
    and once that new interfacing works I would push (assuming Fortran95
    only is a committee decision) to make an exception for at least the
    iso_c_binding module so you don't have to maintain some home-brew
    C/fortran interface forever.

     From my recent very positive experience with the iso_c_binding module,
    the only reason not to go with that module for C/Fortran interfacing
    needs is if if it doesn't work for those needs (which is not my
    experience for a Fortran binding to a C API in the PLplot case with a
    large variety of types of C calls including callbacks) or if there is
    a Fortran compiler out there that does not support it.  I haven't
    found such a compiler yet, but my search has only involved the 3
    compilers referred to above so obviously has not been exhaustive. Is
    there some Fortran compiler you are aware of (aside from really old
    versions of any of them) that does not provide a working iso_c_binding
    module?  And if such a beast exists that does not even support this
    important part of Fortran 2003, do you want to cater to this beast
    indefinitely?  After all, 2003 is quite a few years ago so if a compiler
    doesn't support that, it is almost by definition unsupported.

    Alan
    __________________________
    Alan W. Irwin

    Astronomical research affiliation with Department of Physics and
    Astronomy,
    University of Victoria (astrowww.phys.uvic.ca
    <http://astrowww.phys.uvic.ca>).

    Programming affiliations with the FreeEOS equation-of-state
    implementation for stellar interiors (freeeos.sf.net
    <http://freeeos.sf.net>); the Time
    Ephemerides project (timeephem.sf.net <http://timeephem.sf.net>);
    PLplot scientific plotting
    software package (plplot.sf.net <http://plplot.sf.net>); the libLASi
    project
    (unifont.org/lasi <http://unifont.org/lasi>); the Loads of Linux
    Links project (loll.sf.net <http://loll.sf.net>);
    and the Linux Brochure Project (lbproject.sf.net
    <http://lbproject.sf.net>).
    __________________________

    Linux-powered Science
    __________________________


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to