On Jul 1, 2014, at 2:00 PM, Junchao Zhang <[email protected]> wrote:
Hello, Errata for MPI-3.0 removed the BIND(C) attribute of MPI callback functions. But in an implementation, to pass the Fortran procedure to the backend C, I need to get its C function pointer with c_funloc, as the following code shows. When I compile it with IBM XLF 15.1, it complains with such an error "1516-203 (S) The argument to the intrinsic procedure C_FUNLOC must be a procedure with the BIND(C) attribute." In my experiments, gcc and Cray ftn are fine with it. Looking at https://gcc.gnu.org/onlinedocs/gfortran/C_005fFUNLOC.html, I find c_funloc indeed requires an interoperable function argument. Any comments?
This requirement on the argument of C_FUNLOC was removed by TS 29113, subclause 8.1 “Removed restrictions on ISO_C_BINDING module procedures”. Cheers, Bill
subroutine MPI_Comm_create_errhandler_f08(comm_errhandler_fn, errhandler, ierror) use, intrinsic :: iso_c_binding, only : c_funloc, c_int, c_funptr use :: mpi_f08, only : MPI_Errhandler, MPI_Comm_errhandler_function use :: mpi_c_interface, only : c_Errhandler, MPIR_Comm_create_errhandler_c
implicit none
procedure(MPI_Comm_errhandler_function) :: comm_errhandler_fn type(MPI_Errhandler), intent(out) :: errhandler integer, optional, intent(out) :: ierror
type(c_funptr) :: comm_errhandler_fn_c
comm_errhandler_fn_c = c_funloc(comm_errhandler_fn) !! xlf issues an error ierror_c = MPIR_Comm_create_errhandler_c(comm_errhandler_fn_c, errhandler%MPI_VAL) ... end subroutine MPI_Comm_create_errhandler_f08
--Junchao Zhang _______________________________________________ mpiwg-fortran mailing list [email protected] http://lists.mpi-forum.org/mailman/listinfo.cgi/mpiwg-fortran
Bill Long [email protected] Fortran Technical Suport & voice: 651-605-9024 Bioinformatics Software Development fax: 651-605-9142 Cray Inc./ Cray Plaza, Suite 210/ 380 Jackson St./ St. Paul, MN 55101