(j3.2006) (SC22WG5.3803) [ukfortran] N1761, TYPE(*), BIND(C) and arrays

Aleksandar Donev donev1 at llnl.gov
Tue Dec 9 15:47:15 EST 2008


On Tuesday 09 December 2008 12:32, N.M. Maclaren wrote:

> Bill keeps talking C calling Fortran.  Fine.  In THAT case, I agree
> that all of the arguments are dummy arguments.  That isn't the issue.
>  What about the case of Fortran calling C?  PLEASE take a look at
> that program and consider the issues.
What issues Nick? You sent an example program, which seemed perfectly 
harmless to me, and I said that. Sorry I cannot read minds.

There is no difference between Fortran calling a Fortran BIND(C) 
procedure and Fortran calling a C procedure. The compiler does exactly 
the same thing in both cases, and it need not do any type of analysis 
to figure out what the other procedure is written in. Exactly the same 
restrictions on actual arguments apply (e.g., non-aliasing rules, 
pointer association preservation rules, etc.). This is exactly how it 
is now in C Interop.

In all of your examples, just write the procedure Slough in Fortran:

        SUBROUTINE Slough (arg) BIND(C)
            TYPE(*), DIMENSION(..) :: arg
             WRITE(*,*) "RANK=", RANK(arg)
        END SUBROUTINE Slough

Is there a problem then? What is this problem, please explain. The 
interoperable C interface is:

 	void slough(void * f_desc);

> you and Bill seem to do is to deny that problems exist, even if they
> are shown to exist (and be serious).
No, Reinhold, for example, brought some excellent points and I agree 
with most of them, and have modified my own ballot (yet to be finished) 
accordingly. You also made some good points (e.g., flexible array 
members) in your comments, which I agree with and am ammending. What I 
disagree with is your outrageous comment "this makes no sense, your 
design is flawed from the basics, etc. etc." Sorry, it made sense to at 
least 4 of us involved in writing it.

Best,
Aleks

-- 
Aleksandar Donev, Ph.D.
Lawrence Postdoctoral Fellow @ Lawrence Livermore National Laboratory
High Performance Computational Materials Science and Chemistry
E-mail: donev1 at llnl.gov
Phone: (925) 424-6816  Fax: (925) 423-0785
Address: P.O.Box 808, L-367, Livermore, CA 94551-9900
Web: http://cherrypit.princeton.edu/donev



More information about the J3 mailing list