Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add flag to support Fortran 90/95? #156

Open
sethrj opened this issue Feb 24, 2020 · 11 comments
Open

Add flag to support Fortran 90/95? #156

sethrj opened this issue Feb 24, 2020 · 11 comments

Comments

@sethrj
Copy link
Member

sethrj commented Feb 24, 2020

I've encountered a few projects that include Fortran-90 bindings and are unable to use Fortran-2003 bindings. Legacy C/Fortran compatibility can be achieved, at least for numeric types, with the correct configure-time determination of symbol mangling using such codes as CMake. Is this worth implementing?

If Fortran 90/95 compatibility is needed for your library's users: please leave a comment so I can gauge the interest in this capability. I'm particularly interested in understanding what prevents such projects from compiling with the Fortran 2003 standard. (Available compilers, code infrastructure, etc.) Thanks!

@aprokop
Copy link
Collaborator

aprokop commented Feb 24, 2020

@nuraiman

@sethrj
Copy link
Member Author

sethrj commented Feb 24, 2020

@xiaoyeli SuperLU
@mkstoyanov TASMANIAN

@mkstoyanov
Copy link

Regarding the current project that I'm in collaboration, we are still investigating so I cannot give a definitive answer (yet).

In the past, I have worked with people that insists on Fortran 90 ether because they are unfamiliar or uncomfortable with OOP and/or other features of 2003, or because they want to appeal to people that are unfamiliar/uncomfortable. I even know a case where the devs were holing back from using 2003 features in order to provide "better compatibility", but after some introspection into the code, it turned out that they were indeed using some 2003 features without any compatibility complaints but with the artificial restriction to not use the full 2003 language.

@sethrj
Copy link
Member Author

sethrj commented Feb 24, 2020

OK @mkstoyanov that's good news, because SWIG can generate "non-object-oriented" interfaces that can still guarantee cross-language compatibility.

@xiaoyeli
Copy link

@sethrj @mkstoyanov
I don't use any fancy features in my Fortran90 interface, only modules. I would think Fortran2003 compiler would work.

@nuraiman
Copy link

Hi all, we are interested in Fortran 90 interface.

@sethrj
Copy link
Member Author

sethrj commented Feb 26, 2020

Hi @nuraiman ! Can you please provide some detail on incompatibility with FORTRAN 2003? If it’s just the object oriented design or do your compilers have missing features? Thanks!

@rcoacci
Copy link

rcoacci commented Mar 9, 2020

One of the issues I usually see is that for one reason or another we're forced to use very old compilers. In my work for example I have to support Intel ifort 10.0 on a CentOS5 (we call it a "platform"). Since I'm mostly using swig to generate bindc bindings for C libraries, I'm not seeing many issues, but I had to disable support for said "platform" for my libraries, because ifort 10 doesn't support some of the constructs generated (I think enumerations was one of them).

I don't know what others think but perhaps allowing only bindc bindings with Fortran 90 flag is a middle ground? It's highly probable that those requiring Fortran 90 won't be able to use more than basic ISO C BINDING anyway.

@mkstoyanov
Copy link

@rcoacci So you are stuck with supporting a 13 year old system from before the existence of the iPhone and you have no chance of upgrading to a 12 year old system and ifort 11 which has full Fotran 2003 support (according to wikipedia).

I feel for you.

@sethrj
Copy link
Member Author

sethrj commented Mar 9, 2020

Holy christ. I feel for you too, but it's not surprising. The glacial pace of fortran compiler support for fundamental language features makes it reasonable to allow toggling of some features... I'm pretty sure most compilers still have problems with the FINAL feature. GCC didn't get it working until version 8 I think...

@rcoacci Is your SWIG Fortran input using

%fortranbindc;
%fortranconst;

to eliminate wrappers? Is the enum, bind(c) the only incompatible feature? I could add a flag to use integer, parameter instead of enum.

@rcoacci
Copy link

rcoacci commented Mar 9, 2020

@sethrj yes, mostly I'm using only fortranbindc and fortranconst. One of the reasons is to keep compatibility with pre-swig "wrappers" even on more modern systems. Fortunately, my libs aren't required (yet) to support that ifort 10 system, and I've heard rumors that there is a huge upgrade of that system on the way, so I don't think I'll need that flag, but thanks.

@mkstoyanov well until last year my workstation (and some clusters!) were still CentOS6, now I'm working on a CentOS7 and most clusters are also CentOS7, so we're having some progress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants