interface
  subroutine PetscPrintf(m, c, ierr)
    use, intrinsic :: ISO_C_binding
    use petscmpi
    MPIU_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

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

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

  subroutine MPIU_abort(comm, ierr)
    use, intrinsic :: ISO_C_binding
    use petscmpi
    MPIU_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

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

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

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

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

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

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

#if defined(_WIN32) && defined(PETSC_USE_SHARED_LIBRARIES)
!DEC$ ATTRIBUTES DLLEXPORT::PetscPrintf
!DEC$ ATTRIBUTES DLLEXPORT::PetscErrorf
!DEC$ ATTRIBUTES DLLEXPORT::PetscErrorMPI
!DEC$ ATTRIBUTES DLLEXPORT::MPIU_abort
!DEC$ ATTRIBUTES DLLEXPORT::PetscViewerASCIIStdoutSetFileUnit
!DEC$ ATTRIBUTES DLLEXPORT::PetscLogEventBegin
!DEC$ ATTRIBUTES DLLEXPORT::PetscLogEventEnd
!DEC$ ATTRIBUTES DLLEXPORT::PetscIntArray1dDestroy
!DEC$ ATTRIBUTES DLLEXPORT::PetscShmgetAllocateArrayScalar
!DEC$ ATTRIBUTES DLLEXPORT::PetscShmgetDeallocateArrayScalar
!DEC$ ATTRIBUTES DLLEXPORT::PetscShmgetAllocateArrayInt
!DEC$ ATTRIBUTES DLLEXPORT::PetscShmgetDeallocateArrayInt
#endif
