1! -*- f90 -*-
2!
3! Copyright (c) 2010-2014 Cisco Systems, Inc.  All rights reserved.
4! Copyright (c) 2009-2012 Los Alamos National Security, LLC.
5!                         All rights reserved.
6! $COPYRIGHT$
7
8#include "ompi/mpi/fortran/configure-fortran-output.h"
9
10subroutine MPI_Comm_create_keyval_f08(comm_copy_attr_fn,comm_delete_attr_fn,&
11                                      comm_keyval,extra_state,ierror)
12   use, intrinsic :: iso_c_binding, only: c_funptr, c_funloc
13   use :: mpi_f08_types, only : MPI_ADDRESS_KIND
14   use :: mpi_f08_interfaces_callbacks, only : MPI_Comm_copy_attr_function
15   use :: mpi_f08_interfaces_callbacks, only : MPI_Comm_delete_attr_function
16   use :: mpi_f08, only : ompi_comm_create_keyval_f
17   implicit none
18   PROCEDURE(MPI_Comm_copy_attr_function) :: comm_copy_attr_fn
19   PROCEDURE(MPI_Comm_delete_attr_function) :: comm_delete_attr_fn
20   INTEGER, INTENT(OUT) :: comm_keyval
21   INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: extra_state
22   INTEGER, OPTIONAL, INTENT(OUT) :: ierror
23   integer :: c_ierror
24   type(c_funptr) :: fcopy_fn, fdelete_fn
25
26   fcopy_fn = c_funloc(comm_copy_attr_fn)
27   fdelete_fn = c_funloc(comm_delete_attr_fn)
28   call ompi_comm_create_keyval_f(fcopy_fn,fdelete_fn,&
29                                  comm_keyval,extra_state,c_ierror)
30   if (present(ierror)) ierror = c_ierror
31
32end subroutine MPI_Comm_create_keyval_f08
33