      interface
        subroutine PetscPrintf(m, c, ierr)
          use, intrinsic :: ISO_C_binding
          MPI_Comm :: m
          character(len=*) :: c
          PetscErrorCode :: ierr
        end subroutine

#if defined(PETSC_HAVE_FORTRAN_FREE_LINE_LENGTH_NONE)
        subroutine PetscErrorf(ierr, line, file)
          use, intrinsic :: ISO_C_binding
          PetscErrorCode, intent(in) :: ierr
          integer, intent(in) ::  line
          character(*) file
        end subroutine PetscErrorf

        subroutine PetscErrorMPI(ierr, line, file)
          use, intrinsic :: ISO_C_binding
          PetscErrorCode, intent(inout) :: ierr
          integer, intent(in) ::  line
          character(*) file
        end subroutine PetscErrorMPI
#else
        subroutine PetscErrorf(ierr)
          use, intrinsic :: ISO_C_binding
          PetscErrorCode, intent(in) :: ierr
        end subroutine PetscErrorf

        subroutine PetscErrorMPI(ierr)
          use, intrinsic :: ISO_C_binding
          PetscErrorCode, intent(inout) :: ierr
        end subroutine PetscErrorMPI
#endif

        subroutine MPIU_abort(comm, ierr)
          use, intrinsic :: ISO_C_binding
          MPI_Comm, intent(in) ::  comm
          PetscErrorCode, intent(in) ::  ierr
        end subroutine

        subroutine PetscViewerASCIIStdoutSetFileUnit(unit, z)
          use, intrinsic :: ISO_C_binding
          integer4 unit
          PetscErrorCode, intent(out) :: z
        end subroutine

        subroutine PetscLogEventBegin(event, ierr)
          use, intrinsic :: ISO_C_binding
          PetscLogEvent, intent(in) :: event
          PetscErrorCode, intent(out) :: ierr
        end subroutine PetscLogEventBegin

        subroutine PetscLogEventEnd(event, ierr)
          use, intrinsic :: ISO_C_binding
          PetscLogEvent, intent(in) :: event
          PetscErrorCode, intent(out) :: ierr
        end subroutine PetscLogEventEnd
      end interface

      interface
        function PetscASend(c, d) bind(c, name='PetscASend') result(i)
          use, intrinsic :: iso_c_binding
          implicit none
          integer(c_int), value :: c
          integer(c_int), value :: d
          integer(c_int)        :: i
        end function PetscASend

        function PetscARecv(c, d) bind(c, name='PetscARecv') result(i)
          use, intrinsic :: iso_c_binding
          implicit none
          integer(c_int), value :: c
          integer(c_int), value :: d
          integer(c_int)        :: i
        end function PetscARecv

        function PetscAReduce() bind(c, name='PetscAReduce') result(i)
          use, intrinsic :: iso_c_binding
          implicit none
          integer(c_int) :: i
        end function PetscAReduce
      end interface

      interface
        subroutine PetscIntArray1dDestroy(a, ierr)
          use, intrinsic :: ISO_C_binding
          PetscInt, pointer :: a(:)
          PetscErrorCode    :: ierr
        end subroutine
      end interface

      interface PetscShmgetAllocateArrayScalar
        subroutine PetscShmgetAllocateArrayScalar(start, len, d1, ierr)
          use, intrinsic :: ISO_C_binding
          PetscInt :: start, len
          PetscScalar, pointer :: d1(:)
          PetscErrorCode ierr
        end subroutine
      end interface

      interface PetscShmgetDeallocateArrayScalar
        subroutine PetscShmgetDeallocateArrayScalar(d1, ierr)
          use, intrinsic :: ISO_C_binding
          PetscScalar, pointer :: d1(:)
          PetscErrorCode ierr
        end subroutine
      end interface

      interface PetscShmgetAllocateArrayInt
        subroutine PetscShmgetAllocateArrayInt(start, len, d1, ierr)
          use, intrinsic :: ISO_C_binding
          PetscInt :: start, len
          PetscInt, pointer :: d1(:)
          PetscErrorCode ierr
        end subroutine
      end interface

      interface PetscShmgetDeallocateArrayInt
        subroutine PetscShmgetDeallocateArrayInt(d1, ierr)
          use, intrinsic :: ISO_C_binding
          PetscInt, pointer :: d1(:)
          PetscErrorCode ierr
        end subroutine
      end interface
