From ec594c35e91a6eda8176dd0d22c47e0e986156da Mon Sep 17 00:00:00 2001 From: Ed Hartnett Date: Sun, 14 Jul 2019 08:41:35 -0600 Subject: [PATCH] better handling of nf_free_iosystem --- src/flib/ncint_mod.F90 | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/flib/ncint_mod.F90 b/src/flib/ncint_mod.F90 index 6b2b769303c..0426325c12f 100644 --- a/src/flib/ncint_mod.F90 +++ b/src/flib/ncint_mod.F90 @@ -113,10 +113,28 @@ end subroutine nf_init_intracom !! @retval ierr @copydoc error_return !! @author Ed Hartnett !< - subroutine nf_free_iosystem(iosystem, ierr) - type (iosystem_desc_t), intent(inout) :: iosystem - integer(i4), intent(out) :: ierr - call PIO_finalize(iosystem, ierr) + subroutine nf_free_iosystem() + integer(i4) :: ierr + integer(i4) :: iosysid = 0; + + interface + integer(C_INT) function nc_get_iosystem(iosysid) & + bind(C, name="nc_get_iosystem") + use iso_c_binding + integer(C_INT), intent(in), value :: iosysid + end function nc_get_iosystem + end interface + + interface + integer(C_INT) function PIOc_finalize(iosysid) & + bind(C, name="PIOc_finalize") + use iso_c_binding + integer(C_INT), intent(in), value :: iosysid + end function PIOc_finalize + end interface + + ierr = nc_get_iosystem(iosysid) + ierr = PIOc_finalize(iosysid) end subroutine nf_free_iosystem end module ncint_mod