[J3] BIND(F)?

Van Snyder van.snyder at sbcglobal.net
Tue Jun 28 21:23:34 UTC 2022

On Tue, 2022-06-28 at 23:06 +0300, Ondřej Čertík via J3 wrote:
> On Tue, Jun 28, 2022, at 10:33 PM, Steve Lionel via J3 wrote:
> ...
> > I wish it were otherwise, but that ship sailed decades ago. What
> > was 
> > asked for initially was a way of specifying the global name for an 
> > entity that was not C-interoperable - that is feasible. Trying to 
> > expand the idea into general interoperability across two or more 
> > Fortran compilers is not.
> One way to interoperate between Fortran compilers is via adapters. To
> test the idea, I have written an adapter for GFortran's array
> descriptor, compiled a module using GFortran, then called the
> function from another module (via this adapter) that was compiled
> using Intel Fortran, I linked everything together and it worked.
> However, there is some overhead when converting the GFortran's array
> descriptor. But if you are willing to live with that, it seems to me
> it is technically possible to simply "use" a module compiled by
> another compiler (such as GFortran). The array descriptor (and other
> ABI details) of course change from a version to version, but not too
> often (I think the array descriptor changed only once in the past 10
> years, and only slightly).
> The array descriptor use case I think is now mostly covered by
> ISO_Fortran_binding.h (with the downside that you have to mark such
> subroutines as bind(c)), and it is my understanding that the
> compilers have to convert their internal descriptor to the ISO one,
> so there is an overhead as well. 
> To move this discussion forward, I recommend to have a working
> prototype between compilers that are willing to experiment with this,
> and only then come here and try to standardize it. Jeff, if you are
> able to implement the needed changes in Flang, I am happy to
> prototype things in LFortran, to get started.

Ada faced this reality decades ago. The community developed DIANA, the
Distributed Intermediate Attribute Notation for Ada. DIANA is an
outgrowth of IDL, the Interface Description Language created by William
Wulf and John Nestor  (not to be confused with Interactive Data

With formal descriptions of interfaces used by different compilers, not
necessarily for the same language, it is (probably) possible to produce
a system that generates Ondřej's adapters automatically.

It's probably easier to stand on the shoulders of giants than to re-
invent the wheel.

> Ondrej

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20220628/5dc4105b/attachment.htm>

More information about the J3 mailing list