      Interface
       Subroutine PetscPrintf(m,c,ierr)
          MPI_Comm :: m
          character(len=*) :: c
          PetscErrorCode :: ierr
       End Subroutine

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

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

      subroutine PetscErrorMPI(ierr)
       PetscErrorCode, intent(inout) :: ierr
      end Subroutine PetscErrorMPI
#endif

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

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

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

      subroutine PetscLogEventEnd(event,ierr)
        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)
          PetscInt, Pointer :: a(:)
          PetscErrorCode    :: ierr
        End Subroutine
      End Interface

      Interface PetscShmgetAllocateArrayScalar
        Subroutine PetscShmgetAllocateArrayScalar(start, len, d1, ierr)
          PetscInt :: start, len
          PetscScalar, pointer :: d1(:)
          PetscErrorCode ierr
        End Subroutine
      End Interface

      Interface PetscShmgetDeallocateArrayScalar
        Subroutine PetscShmgetDeallocateArrayScalar(d1, ierr)
          PetscScalar, pointer :: d1(:)
          PetscErrorCode ierr
        End Subroutine
      End Interface

      Interface PetscShmgetAllocateArrayInt
        Subroutine PetscShmgetAllocateArrayInt(start, len, d1, ierr)
          PetscInt :: start, len
          PetscInt, pointer :: d1(:)
          PetscErrorCode ierr
        End Subroutine
      End Interface

      Interface PetscShmgetDeallocateArrayInt
        Subroutine PetscShmgetDeallocateArrayInt(d1, ierr)
          PetscInt, pointer :: d1(:)
          PetscErrorCode ierr
        End Subroutine
      End Interface
