[MPI3 Fortran] Fwd: [Mpi-comments] MPI 3.0:Fortran 2008 interface - issue with the LOGICAL kind

Malcolm Cohen malcolm at nag-j.co.jp
Mon Mar 4 02:00:47 CST 2013


I wrote:
> It would be reasonable to extend C_FUNLOC and C_F_PROCPOINTER to permit 
> non-interoperable procedures, similarly to how we permit non-interoperable 
> variables in C_LOC and C_F_POINTER.  Then the argument could be C_FUNPTR (by 
> value).  I don't know whether this would help you though.

Tobias Burnus replies:
>Regarding the last sentence, I also don't know whether it helps; it seems as if 
>it requires the MPI user to call "c_funloc" and to disable argument checking.

Well, the someone who passes the procedure on to the BIND(C) procedure, i.e. the 
Fortran wrapper, gets to call C_FUNLOC ... so it should not affect the MPI user 
who is not directly calling a BIND(C) procedure himself.

I don't see the need "to disable argument checking".  Of course there will be no 
argument checking on the C_FUNPTR itself, but there can be everywhere else - 
including in the Fortran wrapper - nothing needs to be disabled as far as I can 
see.

> However, I believe the restriction you mention is gone with TS29113. Quoting 
> its Section "8.1 Removed restrictions on ISO_C_BINDING":

Ah right, I didn't check that.  Good.

>However, "9.9 Edits to clause 15" also states:
>'Append the sentence "A C function shall not invoke a a function pointer whose 
>value is the result of a reference to C_FUNLOC with a noninteroperable 
>argument.".'

Well I should certainly hope so!  The C function isn't going to know how to pass 
the arguments to the noninteroperable procedure...

Depending on the callback design, it might well be possible to call the 
noninteroperable procedure via an interoperable wrapper written in Fortran.  I 
have done this kind of thing before... it does require the callback design to be 
capable of handling it though (I cannot comment on the MPI design as I have not 
spent time studying that bit of it).

Cheers,
-- 
................................Malcolm Cohen, Nihon NAG, Tokyo. 




More information about the mpiwg-fortran mailing list