1! -*- f90 -*-
2!
3! Copyright (c) 2009-2014 Cisco Systems, Inc.  All rights reserved.
4! Copyright (c) 2009-2012 Los Alamos National Security, LLC.
5!                         All rights reserved.
6! Copyright (c) 2018      Research Organization for Information Science
7!                         and Technology (RIST).  All rights reserved.
8! $COPYRIGHT$
9
10#include "ompi/mpi/fortran/configure-fortran-output.h"
11
12subroutine PMPI_Type_create_keyval_f08(type_copy_attr_fn,type_delete_attr_fn,&
13                                       type_keyval,extra_state,ierror)
14   use, intrinsic :: iso_c_binding, only: c_funptr, c_funloc
15   use :: mpi_f08_types, only : MPI_ADDRESS_KIND
16   use :: mpi_f08_interfaces_callbacks, only : MPI_Type_copy_attr_function
17   use :: mpi_f08_interfaces_callbacks, only : MPI_Type_delete_attr_function
18   use :: ompi_mpifh_bindings, only : ompi_type_create_keyval_f
19   implicit none
20   PROCEDURE(MPI_Type_copy_attr_function) :: type_copy_attr_fn
21   PROCEDURE(MPI_Type_delete_attr_function) :: type_delete_attr_fn
22   INTEGER, INTENT(OUT) :: type_keyval
23   INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: extra_state
24   INTEGER, OPTIONAL, INTENT(OUT) :: ierror
25   integer :: c_ierror
26   type(c_funptr) :: fcopy_fn, fdelete_fn
27
28   fcopy_fn = c_funloc(type_copy_attr_fn)
29   fdelete_fn = c_funloc(type_delete_attr_fn)
30   call ompi_type_create_keyval_f(fcopy_fn,fdelete_fn,&
31                                  type_keyval,extra_state,c_ierror)
32   if (present(ierror)) ierror = c_ierror
33
34end subroutine PMPI_Type_create_keyval_f08
35